java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml | 52
++
java/code/src/com/redhat/rhn/common/messaging/MessageQueue.java | 4
java/code/src/com/redhat/rhn/frontend/action/ssm/ErrataListAction.java | 200
++++++++++
java/code/src/com/redhat/rhn/frontend/events/SsmErrataAction.java | 59
++
java/code/src/com/redhat/rhn/frontend/events/SsmErrataEvent.java | 112
+++++
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 26 +
java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java | 35 +
java/code/webapp/WEB-INF/nav/ssm.xml | 20 -
java/code/webapp/WEB-INF/pages/common/fragments/systems/system_listdisplay.jspf | 28 -
java/code/webapp/WEB-INF/pages/ssm/systems/ssm-errata.jsp | 153
+++++++
java/code/webapp/WEB-INF/struts-config.xml | 43
+-
11 files changed, 692 insertions(+), 40 deletions(-)
New commits:
commit 896f7420c7274f745af4047abf39e6c710386101
Author: Tomas Kasparek <tkasparek(a)redhat.com>
Date: Fri Aug 23 10:53:57 2013 +0200
removing redundant call
diff --git a/java/code/src/com/redhat/rhn/frontend/action/ssm/ErrataListAction.java
b/java/code/src/com/redhat/rhn/frontend/action/ssm/ErrataListAction.java
index db2eaa5..eebc0dc 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/ssm/ErrataListAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/ssm/ErrataListAction.java
@@ -191,7 +191,6 @@ public class ErrataListAction extends RhnAction implements Listable {
}
systemOverview.setEntitlement(entitlement);
- systemOverview.getEntitlementLevel();
}
}
}
commit d2343168a2fa34346c3bfa7a2812cf407e39d8ec
Author: Bo Maryniuk <bo(a)suse.de>
Date: Thu Aug 22 18:36:07 2013 +0200
Perl to JSP port: SSM/Errata
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
index 69027df..a4a1a07 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
@@ -941,6 +941,58 @@ SELECT E.id, E.advisory, E.advisory_name, E.advisory_type,
E.update_date, E.syn
ORDER BY E.update_date DESC
</query>
+<mode name="in_set_and_affected_by_errata"
class="com.redhat.rhn.frontend.dto.SystemOverview">
+ <query params="eid, user_id">
+ SELECT S.ID, S.name,
+ (SELECT count(errata_id)
+ FROM rhnservererratatypeview
+ WHERE server_id = S.id AND errata_type = 'Security Advisory') AS
security_errata,
+ (SELECT count(errata_id)
+ FROM rhnservererratatypeview
+ WHERE server_id = S.id AND errata_type = 'Product Enhancement Advisory')
AS enhancement_errata,
+ (SELECT count(errata_id)
+ FROM rhnservererratatypeview
+ WHERE server_id = S.id AND errata_type = 'Bug Fix Advisory') AS
bug_errata,
+ (SELECT COUNT(pn.id) AS COUNT
+ FROM rhnPackageName PN,
+ (SELECT SOP.package_name_id AS name_id, MAX(PE.evr) evr
+ FROM rhnPackageEVR PE, rhnServerOutdatedPackages SOP
+ WHERE SOP.server_id = S.id
+ AND SOP.package_evr_id = PE.id
+ GROUP BY SOP.package_name_id) full_list
+ WHERE full_list.name_id = PN.id) AS pending_updates
+ FROM rhnServer S, rhnSet ST
+ WHERE EXISTS (SELECT 1
+ FROM rhnServerNeededErrataCache SNEC, rhnUserServerPerms USP
+ WHERE SNEC.errata_id = :eid
+ AND USP.user_id = :user_id
+ AND SNEC.server_id = USP.server_id
+ AND USP.server_id = S.id)
+ AND ST.user_id = :user_id
+ AND ST.label = 'system_list'
+ AND ST.element = S.id
+ORDER BY UPPER(COALESCE(S.NAME, '(none)')), S.ID
+ </query>
+ <elaborator name="system_overview" />
+ <elaborator name="entitlements"/>
+</mode>
+
+
+<mode name="relevant_to_system_set"
class="com.redhat.rhn.frontend.dto.ErrataOverview">
+ <query params="user_id">
+SELECT E.id, E.advisory, E.advisory_name, E.advisory_type, E.update_date, E.synopsis as
advisory_synopsis
+ FROM rhnErrata E,
+ (SELECT SNEC.errata_id, COUNT(SNEC.server_id) C
+ FROM rhnServerNeededErrataCache SNEC
+ WHERE SNEC.server_id IN (SELECT element FROM rhnSet WHERE user_id = :user_id AND
label = 'system_list')
+ AND errata_id IS NOT NULL
+ GROUP BY SNEC.errata_id) X
+ WHERE E.id = X.errata_id
+ORDER BY E.update_date DESC, E.id
+ </query>
+ <elaborator name="relevant_to_system_set_elab" />
+</mode>
+
<query name="relevant_to_system_set_elab" params="user_id">
SELECT E.id, E.advisory, E.advisory_name, E.advisory_type,
E.synopsis AS advisory_synopsis,
diff --git a/java/code/src/com/redhat/rhn/common/messaging/MessageQueue.java
b/java/code/src/com/redhat/rhn/common/messaging/MessageQueue.java
index 056f947..19b6cca 100644
--- a/java/code/src/com/redhat/rhn/common/messaging/MessageQueue.java
+++ b/java/code/src/com/redhat/rhn/common/messaging/MessageQueue.java
@@ -35,6 +35,8 @@ import
com.redhat.rhn.frontend.events.SsmChangeChannelSubscriptionsAction;
import com.redhat.rhn.frontend.events.SsmChangeChannelSubscriptionsEvent;
import com.redhat.rhn.frontend.events.SsmDeleteServersAction;
import com.redhat.rhn.frontend.events.SsmDeleteServersEvent;
+import com.redhat.rhn.frontend.events.SsmErrataAction;
+import com.redhat.rhn.frontend.events.SsmErrataEvent;
import com.redhat.rhn.frontend.events.TraceBackAction;
import com.redhat.rhn.frontend.events.TraceBackEvent;
import com.redhat.rhn.frontend.events.UpdateErrataCacheAction;
@@ -285,6 +287,8 @@ public class MessageQueue {
CloneErrataEvent.class);
MessageQueue.registerAction(new NewCloneErrataAction(),
NewCloneErrataEvent.class);
+ MessageQueue.registerAction(new SsmErrataAction(),
+ SsmErrataEvent.class);
// Misc
MessageQueue.registerAction(new SsmSystemRebootAction(),
diff --git a/java/code/src/com/redhat/rhn/frontend/action/ssm/ErrataListAction.java
b/java/code/src/com/redhat/rhn/frontend/action/ssm/ErrataListAction.java
new file mode 100644
index 0000000..db2eaa5
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/action/ssm/ErrataListAction.java
@@ -0,0 +1,201 @@
+/**
+ * Copyright (c) 2013 SUSE
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ *
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+
+package com.redhat.rhn.frontend.action.ssm;
+
+import com.redhat.rhn.common.localization.LocalizationService;
+import com.redhat.rhn.common.messaging.MessageQueue;
+import com.redhat.rhn.common.util.DatePicker;
+import com.redhat.rhn.domain.entitlement.Entitlement;
+import com.redhat.rhn.domain.rhnset.RhnSet;
+import com.redhat.rhn.domain.server.Server;
+import com.redhat.rhn.domain.user.User;
+import com.redhat.rhn.frontend.action.SetLabels;
+import com.redhat.rhn.frontend.dto.SystemOverview;
+import com.redhat.rhn.frontend.events.SsmErrataEvent;
+import com.redhat.rhn.frontend.struts.RequestContext;
+import com.redhat.rhn.frontend.struts.RhnAction;
+import com.redhat.rhn.frontend.struts.RhnHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.ListRhnSetHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.ListSessionSetHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.Listable;
+import com.redhat.rhn.manager.errata.ErrataManager;
+import com.redhat.rhn.manager.rhnset.RhnSetDecl;
+import com.redhat.rhn.manager.system.SystemManager;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.apache.struts.action.DynaActionForm;
+
+/**
+ *
+ * @author bo
+ */
+public class ErrataListAction extends RhnAction implements Listable {
+ //public static final String LIST_NAME = "errataList";
+ public static final String SELECTOR = "type";
+ public static final String RP_AFFECTED_SYSTEMS = "afs"; // Request param
+ private static final String MULTIBIND = "_bind_." +
+ ErrataListAction.class.getCanonicalName();
+ private static final String MULTIBIND_SUMMARY = "summaryList";
+ private static final String MULTIBIND_DETAILS = "detailsList";
+
+ /**
+ * Entry-point caller.
+ * <p/>
+ * @param mapping The ActionMapping used to select this instance.
+ * @param actionForm The optional ActionForm bean for this request.
+ * @param request The HTTP Request we are processing.
+ * @param response The HTTP Response we are processing.
+ * <p/>
+ * @return ActionForward returns an action forward
+ * @throws java.lang.Exception General exception.
+ */
+ @Override
+ public ActionForward execute(ActionMapping mapping,
+ ActionForm actionForm,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws Exception {
+ RequestContext requestContext = new RequestContext(request);
+ User user = requestContext.getLoggedInUser();
+ DynaActionForm form = (DynaActionForm) actionForm;
+ ActionMessages actionMessages = new ActionMessages();
+
+ String forwardId = RhnHelper.DEFAULT_FORWARD;
+
+ ListRhnSetHelper setHelper = this.bindDatasets(request);
+
+ if (setHelper.isDispatched()) {
+ if (requestContext.wasDispatched("errata.jsp.apply")) {
+ List<SystemOverview> srv = SystemManager.inSet(user,
SetLabels.SYSTEM_LIST);
+ List<Long> serverIds = new ArrayList<Long>();
+ for (int i = 0; i < srv.size(); i++) {
+ serverIds.add(srv.get(i).getId());
+ }
+
+ RhnSet packages = setHelper.getSet();
+ List<Long> errataIds = new ArrayList<Long>();
+ Iterator<Long> iter = packages.getElementValues().iterator();
+ while (iter.hasNext()) {
+ errataIds.add(iter.next());
+ }
+
+ Date scheduleDate = this.getStrutsDelegate().readDatePicker(
+ form, "date", DatePicker.YEAR_RANGE_POSITIVE);
+
+ MessageQueue.publish(new SsmErrataEvent(
+ user.getId(),
+ scheduleDate,
+ errataIds,
+ serverIds)
+ );
+ actionMessages.add(
+ ActionMessages.GLOBAL_MESSAGE,
+ new ActionMessage("ssm.errata.message.scheduled",
+ LocalizationService.getInstance().formatDate(
+ scheduleDate, request.getLocale())));
+ forwardId = "confirm";
+ }
+ }
+
+ this.getStrutsDelegate().saveMessages(request, actionMessages);
+
+ request.setAttribute("date",
this.getStrutsDelegate().prepopulateDatePicker(
+ request, (DynaActionForm) form, "date",
DatePicker.YEAR_RANGE_POSITIVE));
+ request.setAttribute("parentUrl", request.getRequestURI());
+ request.setAttribute(SELECTOR, request.getParameter(SELECTOR));
+
+ return mapping.findForward(forwardId);
+ }
+
+
+ private ListRhnSetHelper bindDatasets(HttpServletRequest request) {
+ request.setAttribute(ErrataListAction.MULTIBIND,
+ ErrataListAction.MULTIBIND_SUMMARY);
+ ListRhnSetHelper shlp = new ListRhnSetHelper(this,
+ request, ErrataListAction.getSetDecl(0L));
+ shlp.setListName((String) request.getAttribute(ErrataListAction.MULTIBIND));
+ shlp.setParentUrl(request.getRequestURI());
+ shlp.execute();
+
+ if (request.getParameter(ErrataListAction.RP_AFFECTED_SYSTEMS) != null) {
+ request.setAttribute(ErrataListAction.MULTIBIND,
+ ErrataListAction.MULTIBIND_DETAILS);
+ ListSessionSetHelper h = new ListSessionSetHelper(this, request, new
HashMap());
+ h.setDataSetName((String) request.getAttribute(ErrataListAction.MULTIBIND));
+ h.execute();
+ }
+
+ return shlp;
+ }
+
+
+ /**
+ * @return Returns RhnSetDecl.ERRATA
+ */
+ static RhnSetDecl getSetDecl(Long sid) {
+ return RhnSetDecl.ERRATA.createCustom(sid);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public List getResult(RequestContext context) {
+ List<SystemOverview> systems = null;
+ if (context.getRequest().getAttribute(ErrataListAction.MULTIBIND)
+ .equals(ErrataListAction.MULTIBIND_SUMMARY)) {
+ systems =
ErrataManager.relevantErrataToSystemSet(context.getLoggedInUser());
+ }
+ else if (context.getRequest().getAttribute(ErrataListAction.MULTIBIND)
+ .equals(ErrataListAction.MULTIBIND_DETAILS)) {
+ systems = ErrataManager.systemsAffectedInSet(
+ context.getCurrentUser(),
+ Long.parseLong(
+ context.getRequest().getParameter(
+ ErrataListAction.RP_AFFECTED_SYSTEMS)
+ )
+ );
+ if (systems != null) {
+ for (int i = 0; i < systems.size(); i++) {
+ SystemOverview systemOverview = systems.get(i);
+ Server server =
SystemManager.lookupByIdAndUser(systemOverview.getId(),
+
context.getLoggedInUser());
+ systemOverview.setChannelId(server.getBaseChannel().getId());
+ systemOverview.setChannelLabels(server.getBaseChannel().getName());
+
+ List entitlement = new ArrayList();
+ for (Iterator<Entitlement> itr =
server.getEntitlements().iterator();
+ itr.hasNext();) {
+ entitlement.add(itr.next().getLabel());
+ }
+
+ systemOverview.setEntitlement(entitlement);
+ systemOverview.getEntitlementLevel();
+ }
+ }
+ }
+
+ return systems;
+ }
+}
diff --git a/java/code/src/com/redhat/rhn/frontend/events/SsmErrataAction.java
b/java/code/src/com/redhat/rhn/frontend/events/SsmErrataAction.java
new file mode 100644
index 0000000..95830e1
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/events/SsmErrataAction.java
@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) 2013 SUSE
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ *
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.frontend.events;
+
+import com.redhat.rhn.common.messaging.EventMessage;
+import com.redhat.rhn.domain.user.User;
+import com.redhat.rhn.domain.user.UserFactory;
+import com.redhat.rhn.manager.errata.ErrataManager;
+import com.redhat.rhn.manager.rhnset.RhnSetDecl;
+import com.redhat.rhn.manager.ssm.SsmOperationManager;
+import org.apache.log4j.Logger;
+
+/**
+ * SSM Errata Action
+ *
+ * @author Bo Maryniuk
+ */
+public class SsmErrataAction extends AbstractDatabaseAction {
+ private static Logger log = Logger.getLogger(SsmRemovePackagesAction.class);
+
+ /** {@inheritDoc} */
+ @Override
+ protected void doExecute(EventMessage msg) {
+ SsmErrataAction.log.debug("Scheduling errata in SSM.");
+
+ SsmErrataEvent event = (SsmErrataEvent) msg;
+ User user = UserFactory.lookupById(event.getUserId());
+
+ try {
+ ErrataManager.applyErrata(user,
+ event.getErrataIds(),
+ event.getEarliest(),
+ event.getServerIds());
+ }
+ catch (Exception e) {
+ SsmErrataAction.log.error("Error scheduling SSM errata for event: "
+ event, e);
+ }
+ finally {
+ SsmOperationManager.completeOperation(
+ user,
+ SsmOperationManager.createOperation(user,
+
"ssm.package.remove.operationname",
+ RhnSetDecl.SYSTEMS.getLabel())
+ );
+ }
+ }
+}
diff --git a/java/code/src/com/redhat/rhn/frontend/events/SsmErrataEvent.java
b/java/code/src/com/redhat/rhn/frontend/events/SsmErrataEvent.java
new file mode 100644
index 0000000..a9b85de
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/events/SsmErrataEvent.java
@@ -0,0 +1,112 @@
+/**
+ * Copyright (c) 2013 SUSE
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ *
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.frontend.events;
+
+import com.redhat.rhn.common.messaging.EventMessage;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * SSM Errata Event object.
+ *
+ * @author Bo Maryniuk <bo(a)suse.de>
+ */
+public class SsmErrataEvent implements EventMessage {
+ private final Long userId;
+ private final Date earliest;
+ private final List<Long> errataIds;
+ private final List<Long> serverIds;
+
+ /**
+ * SSM Errata Event object constructor.
+ *
+ * @param uid User ID
+ * @param scheduleDate Earliest possible schedule.
+ * @param errataList List of erratas (ID)
+ * @param serverList List of relevant servers (ID)
+ */
+ public SsmErrataEvent(Long uid,
+ Date scheduleDate,
+ List<Long> errataList,
+ List<Long> serverList) {
+ if (uid == null) {
+ throw new IllegalArgumentException("User ID cannot be null.");
+ }
+ else if (errataList == null) {
+ throw new IllegalArgumentException("Errata IDs cannot be null");
+ }
+ else if (serverList == null) {
+ throw new IllegalArgumentException("Server IDs cannot be null");
+ }
+
+ this.userId = uid;
+ this.earliest = scheduleDate;
+ this.errataIds = errataList;
+ this.serverIds = serverList;
+ }
+
+
+ /**
+ * Get UID.
+ *
+ * @return will not be <code>null</code>
+ */
+ public Long getUserId() {
+ return userId;
+ }
+
+ /**
+ * Get earliest possible scheduling date.
+ *
+ * @return may be <code>null</code>
+ */
+ public Date getEarliest() {
+ return earliest;
+ }
+
+ /**
+ * Get errata IDs.
+ *
+ * @return List List of errata IDs
+ */
+ public List<Long> getErrataIds() {
+ return Collections.unmodifiableList(this.errataIds);
+ }
+
+ /**
+ * Get server IDs.
+ *
+ * @return List List of Server IDs
+ */
+ public List<Long> getServerIds() {
+ return Collections.unmodifiableList(this.serverIds);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return String.format("SsmErrataEvent[User: %s, Objects: %s, Systems:
%s]",
+ this.getUserId(),
+ this.getErrataIds().size(),
+ this.getServerIds().size());
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String toText() {
+ return this.toString();
+ }
+}
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
index 54a8002..62d01a2 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
@@ -2769,6 +2769,12 @@ button below, and <b>will be unable to log back
in</b>.</source>
<context
context-type="sourcefile">/rhn/systems/details/ErrataList</context>
</context-group>
</trans-unit>
+ <trans-unit id="errata.jsp.affected">
+ <source>Affected</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/systems/details/ErrataList</context>
+ </context-group>
+ </trans-unit>
<trans-unit id="errataconfirm.jsp.header">
<source>Confirm Errata Updates</source>
<context-group name="ctx">
@@ -3252,7 +3258,7 @@ button below, and <b>will be unable to log back
in</b>.</source>
</context-group>
</trans-unit>
<trans-unit id="affectedsystems.jsp.none">
- <source>None</source>
+ <source>N/A</source>
<context-group name="ctx">
<context
context-type="sourcefile">/rhn/errata/details/SystemsAffected</context>
</context-group>
@@ -4339,7 +4345,7 @@ value for this entitlement, excluding the default organization's
consumption.</s
<source>Errata</source>
</trans-unit>
<trans-unit id="ssm.overview.errata.schedule">
- <source><a
href="/network/systems/ssm/errata/index.pxt?pxt:trap=rhn:empty_set&set_label=errata_list">Schedule
errata updates</a> relevant to selected systems</source>
+ <source><a
href="/rhn/systems/ssm/ListPatches.do">Schedule errata
updates</a> relevant to selected systems</source>
</trans-unit>
<trans-unit id="ssm.overview.packages">
<source>Packages</source>
@@ -4416,6 +4422,12 @@ value for this entitlement, excluding the default
organization's consumption.</s
<trans-unit id="ssm.overview.misc.scap">
<source><a
href="/rhn/systems/ssm/audit/ScheduleXccdf.do">Audit</a>
systems with OpenSCAP</source>
</trans-unit>
+ <trans-unit id="ssm.errata.serverlist.return">
+ <source>Back to errata</source>
+ </trans-unit>
+ <trans-unit id="ssm.errata.message.scheduled">
+ <source>Errata updates <a
href="/rhn/schedule/PendingActions.do">scheduled</a> at
{0}.</source>
+ </trans-unit>
</group>
<!-- SSM System List -->
<group>
@@ -4619,7 +4631,7 @@ value for this entitlement, excluding the default organization's
consumption.</s
<trans-unit id="ssm.misc.index.syspref.no">
<source>No</source>
</trans-unit>
-
+
<trans-unit id="ssm.misc.reboot.header">
<source>Reboot of the Systems</source>
</trans-unit>
@@ -14769,6 +14781,14 @@ any of these revisions. Are you sure you want to do
this?</source>
<trans-unit id="stringutil.scriptcheck.error.noscript">
<source>Script is does not seems like doing anything.</source>
</trans-unit>
+
+ <!-- Errata -->
+ <trans-unit id="ssm.patches.list.header">
+ <source>Relevant Errata List</source>
+ </trans-unit>
+ <trans-unit id="ssm.patches.list.summary">
+ <source>The errata below apply to one or more of your selected
systems.</source>
+ </trans-unit>
</group>
<!-- ssm/packages.jsp -->
diff --git a/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java
b/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java
index a949fc0..d3b0d2c4 100644
--- a/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java
+++ b/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java
@@ -45,6 +45,7 @@ import com.redhat.rhn.frontend.dto.ChannelOverview;
import com.redhat.rhn.frontend.dto.ErrataOverview;
import com.redhat.rhn.frontend.dto.OwnedErrata;
import com.redhat.rhn.frontend.dto.PackageOverview;
+import com.redhat.rhn.frontend.dto.SystemOverview;
import com.redhat.rhn.frontend.events.CloneErrataEvent;
import com.redhat.rhn.frontend.events.NewCloneErrataEvent;
import com.redhat.rhn.frontend.listview.PageControl;
@@ -345,7 +346,24 @@ public class ErrataManager extends BaseManager {
* @return relevant errata.
*/
public static DataResult relevantErrata(User user) {
- SelectMode m = ModeFactory.getMode("Errata_queries",
"relevant_errata");
+ return ErrataManager.getRelevantErrata(user, false);
+ }
+
+ /**
+ * Returns the relevant errata to the system set (used in SSM).
+ *
+ * @param user Currently logged in user.
+ * @return relevant errata.
+ */
+ public static DataResult relevantErrataToSystemSet(User user) {
+ return ErrataManager.getRelevantErrata(user, true);
+ }
+
+ private static DataResult getRelevantErrata(User user, boolean ssm) {
+ SelectMode m = ModeFactory.getMode("Errata_queries",
+ ssm ?
+ "relevant_to_system_set" :
+ "relevant_errata");
Map params = new HashMap();
params.put("user_id", user.getId());
Map elabParams = new HashMap();
@@ -728,6 +746,21 @@ public class ErrataManager extends BaseManager {
}
/**
+ * Returns the systems affected by a given errata
+ *
+ * @param user Logged-in user.
+ * @param eid Errata ID.
+ * @return systems Affected by current errata, that are in the set of SSM.
+ */
+ public static List<SystemOverview> systemsAffectedInSet(User user, Long eid) {
+ Map params = new HashMap();
+ params.put("eid", eid);
+ params.put("user_id", user.getId());
+ return ModeFactory.getMode("Errata_queries",
+
"in_set_and_affected_by_errata").execute(params);
+ }
+
+ /**
* Returns the system id and system names of the systems affected by a given errata
* @param user The logged in user
* @param eid The id of the errata in question
diff --git a/java/code/webapp/WEB-INF/nav/ssm.xml b/java/code/webapp/WEB-INF/nav/ssm.xml
index daf3db7..eca4194 100644
--- a/java/code/webapp/WEB-INF/nav/ssm.xml
+++ b/java/code/webapp/WEB-INF/nav/ssm.xml
@@ -1,18 +1,12 @@
<?xml version="1.0"?>
<rhn-navi-tree label="ssm" invisible="1"
title-depth="1">
- <rhn-tab name="Overview" url="/rhn/ssm/index.do" />
- <rhn-tab name="Systems">
-<!-- <rhn-tab-url>/network/systems/ssm/system_list.pxt</rhn-tab-url>
-->
- <rhn-tab-url>/rhn/systems/ssm/ListSystems.do</rhn-tab-url>
- </rhn-tab>
-
- <rhn-tab name="Errata"
- on-click="Sniglets::Lists->navi_empty_set"
- node-id="system_errata_list">
- <rhn-tab-url>/network/systems/ssm/errata/index.pxt</rhn-tab-url>
- <rhn-tab-url>/network/systems/ssm/errata/systems_affected.pxt</rhn-tab-url>
- <rhn-tab-url>/network/systems/ssm/errata/apply_errata_confirm.pxt</rhn-tab-url>
- </rhn-tab>
+ <rhn-tab name="Overview" url="/rhn/ssm/index.do" />
+ <rhn-tab name="Systems">
+ <rhn-tab-url>/rhn/systems/ssm/ListSystems.do</rhn-tab-url>
+ </rhn-tab>
+ <rhn-tab name="Errata">
+ <rhn-tab-url>/rhn/systems/ssm/ListPatches.do</rhn-tab-url>
+ </rhn-tab>
<rhn-tab name="Packages">
<rhn-tab-url>/rhn/ssm/Packages.do</rhn-tab-url>
diff --git
a/java/code/webapp/WEB-INF/pages/common/fragments/systems/system_listdisplay.jspf
b/java/code/webapp/WEB-INF/pages/common/fragments/systems/system_listdisplay.jspf
index 0fad026..ec49ca8 100644
--- a/java/code/webapp/WEB-INF/pages/common/fragments/systems/system_listdisplay.jspf
+++ b/java/code/webapp/WEB-INF/pages/common/fragments/systems/system_listdisplay.jspf
@@ -11,19 +11,19 @@
<c:set var="namestyle" value = "first-column"/>
</c:otherwise>
</c:choose>
-
+
<rl:list
dataset="pageList"
name="systemList"
emptykey="nosystems.message"
- alphabarcolumn="name"
+ alphabarcolumn="name"
filter="com.redhat.rhn.frontend.taglibs.list.filters.SystemOverviewFilter"
-
+
<rl:decorator name="ElaborationDecorator"/>
<rl:decorator name="SystemIconDecorator"/>
<rl:decorator name="PageSizeDecorator"/>
-
+
<c:if test = "${empty notSelectable}">
<rl:decorator name="SelectableDecorator"/>
<rl:selectablecolumn value="${current.id}"
@@ -39,8 +39,8 @@
styleclass="${namestyle}">
<%@ include
file="/WEB-INF/pages/common/fragments/systems/system_list_fragment.jspf" %>
</rl:column>
-
-
+
+
<c:if test = "${empty extraPackagesMode}">
<!--Updates Column -->
<rl:column sortable="false"
@@ -49,9 +49,9 @@
styleclass="center"
headerclass="thin-column">
<c:out value="${current.statusDisplay}"
escapeXml="false"/>
- </rl:column>
- </c:if>
-
+ </rl:column>
+ </c:if>
+
<c:if test = "${empty noMonitoring and empty extraPackagesMode}">
<!-- Health Column -->
<%@ include file="monitoring_status_systems.jspf" %>
@@ -139,7 +139,7 @@
attr="lastCheckin"
bound="true"
headerkey="systemlist.jsp.last_checked_in"/>
-
+
</c:if>
<c:if test = "${not empty showLastCheckinSort}">
@@ -156,7 +156,7 @@
headerkey="systemlist.jsp.channel" >
<%@ include
file="/WEB-INF/pages/common/fragments/channel/channel_list_fragment.jspf" %>
</rl:column>
-
+
<!-- Entitlement Column -->
<c:if test="${empty extraPackagesMode}">
<rl:column sortable="false"
@@ -165,9 +165,9 @@
<c:out value="${current.entitlementLevel}"
escapeXml="false"/>
</rl:column>
</c:if>
-
-
-
+
+
+
</rl:list>
<c:if test = "${empty noCsv}">
<rl:csv dataset="pageList"
diff --git a/java/code/webapp/WEB-INF/pages/ssm/systems/ssm-errata.jsp
b/java/code/webapp/WEB-INF/pages/ssm/systems/ssm-errata.jsp
new file mode 100644
index 0000000..2a036a5
--- /dev/null
+++ b/java/code/webapp/WEB-INF/pages/ssm/systems/ssm-errata.jsp
@@ -0,0 +1,153 @@
+<%--
+ Document : ssm-errata
+ Created on : Aug 22, 2013, 1:18:24 PM
+ Author : Bo Maryniuk
+--%>
+
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+
+<%@taglib
uri="http://rhn.redhat.com/rhn" prefix="rhn" %>
+<%@taglib
uri="http://java.sun.com/jsp/jstl/core" prefix="c"
%>
+<%@taglib
uri="http://struts.apache.org/tags-html" prefix="html"
%>
+<%@taglib
uri="http://struts.apache.org/tags-bean" prefix="bean"
%>
+<%@taglib
uri="http://rhn.redhat.com/tags/list" prefix="rl" %>
+<%@ page import="com.redhat.rhn.frontend.action.ssm.ErrataListAction" %>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html:xhtml/>
+<html>
+ <body>
+ <%@ include file="/WEB-INF/pages/common/fragments/ssm/header.jspf"
%>
+ <h2><bean:message key="ssm.patches.list.header"
/></h2>
+ <p><bean:message key="ssm.patches.list.summary"
/></p>
+
+ <c:choose>
+ <c:when test="${empty param.afs}">
+ <rl:listset name="errataListSet" legend="errata">
+ <rhn:csrf />
+ <rhn:submitted />
+ <rl:list width="100%" name="summaryList"
styleclass="list"
+ emptykey="erratalist.jsp.norelevanterrata"
alphabarcolumn="advisorySynopsis">
+ <rl:decorator name="ElaborationDecorator"/>
+ <rl:decorator name="PageSizeDecorator"/>
+ <rl:decorator name="SelectableDecorator"/>
+
+ <rl:selectablecolumn value="${current.id}"
selected="${current.selected}"
+ disabled="${not current.selectable}"
styleclass="first-column"/>
+
+ <rl:column headerkey="erratalist.jsp.type"
styleclass="text-align: center;" bound="false">
+ <c:if test="${current.securityAdvisory}">
+ <img src="/img/wrh-security.gif"
title="<bean:message key="erratalist.jsp.securityadvisory"/>"
/>
+ </c:if>
+ <c:if test="${current.bugFix}">
+ <img src="/img/wrh-bug.gif"
title="<bean:message key="erratalist.jsp.bugadvisory"/>" />
+ </c:if>
+ <c:if test="${current.productEnhancement}">
+ <img src="/img/wrh-product.gif"
title="<bean:message
key="erratalist.jsp.productenhancementadvisory"/>" />
+ </c:if>
+ </rl:column>
+
+ <rl:column headerkey="erratalist.jsp.advisory"
bound="false" sortattr="advisoryName" sortable="true">
+ <a
href="/rhn/errata/details/Details.do?eid=${current.id}">${current.advisoryName}</a>
+ </rl:column>
+
+ <rl:column headerkey="erratalist.jsp.synopsis"
bound="false" sortattr="advisorySynopsis"
+ sortable="true"
filterattr="advisorySynopsis">
+ ${current.advisorySynopsis}
+ </rl:column>
+
+ <rl:column headerkey="errata.jsp.status"
bound="false" sortattr="currentStatusAndActionId[0]"
sortable="true">
+ <c:if test="${not empty current.status}">
+ <c:if test="${current.currentStatusAndActionId[0] ==
'Queued'}">
+ <a
href="/rhn/schedule/ActionDetails.do?aid=${current.currentStatusAndActionId[1]}">
+ <bean:message
key="affectedsystems.jsp.pending"/>
+ </a>
+ </c:if>
+ <c:if test="${current.currentStatusAndActionId[0] ==
'Failed'}">
+ <a
href="/network/systems/details/history/event.pxt?sid=${param.sid}&hid=${current.currentStatusAndActionId[1]}">
+ <bean:message key="actions.jsp.failed"/>
+ </a>
+ </c:if>
+ <c:if test="${current.currentStatusAndActionId[0] ==
'Picked Up'}">
+ <a
href="/network/systems/details/history/event.pxt?sid=${param.sid}&hid=${current.currentStatusAndActionId[1]}">
+ <bean:message
key="actions.jsp.pickedup"/>
+ </a>
+ </c:if>
+ </c:if>
+ <c:if test="${empty current.status}">
+ <bean:message key="affectedsystems.jsp.none"/>
+ </c:if>
+ </rl:column>
+
+ <rl:column headerkey="errata.jsp.affected"
bound="false" sortattr="affectedSystemCount"
sortable="true">
+ <a
href="/rhn/systems/ssm/ListPatches.do?<%=ErrataListAction.RP_AFFECTED_SYSTEMS%>=${current.id}">${current.affectedSystemCount}</a>
+ </rl:column>
+
+ <rl:column headerkey="erratalist.jsp.updated"
bound="false" sortattr="updateDateObj"
+ sortable="true" defaultsort="desc"
styleclass="last-column">
+ ${current.updateDate}
+ </rl:column>
+
+ </rl:list>
+
+ <div align="left">
+ <!--
+ <p><bean:message
key="installconfirm.jsp.widgetsummary"/></p>
+ -->
+ <table class="details" align="center">
+ <tr>
+ <th><label
for="radio_use_date_now"><bean:message
key="scheduleremote.jsp.nosoonerthan"/></label></th>
+ <td>
+ <jsp:include
page="/WEB-INF/pages/common/fragments/date-picker.jsp">
+ <jsp:param name="widget"
value="date"/>
+ </jsp:include><br/><p/>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div align="right">
+ <hr />
+ <html:submit property="dispatch">
+ <bean:message key="errata.jsp.apply"/>
+ </html:submit>
+ </div>
+ <rhn:submitted/>
+ </rl:listset>
+ </c:when>
+ <c:otherwise>
+ <rl:listset name="groupSet" legend="system">
+ <rhn:csrf />
+ <rl:list dataset="detailsList" width="100%"
name="detailsList"
+ styleclass="list"
emptykey="ssm.operations.actionchaindetails.table.empty">
+ <rl:decorator name="PageSizeDecorator"/>
+ <rl:column headerkey="systemlist.jsp.system"
bound="false" sortattr="advisoryName" sortable="true">
+ <a
href="/rhn/systems/details/Overview.do?sid=${current.id}">${current.name}</a>
+ </rl:column>
+ <rl:column headerkey="ssm.overview.errata"
bound="false" sortattr="advisoryName" sortable="true">
+ <a
href="/rhn/systems/details/ErrataList.do?sid=${current.id}">${current.totalErrataCount}</a>
+ </rl:column>
+ <rl:column headerkey="ssm.overview.packages"
bound="false" sortattr="advisoryName" sortable="true">
+ <a
href="/rhn/systems/details/packages/UpgradableList.do?sid=${current.id}">${current.pendingUpdates}</a>
+ </rl:column>
+ <rl:column sortable="false" bound="false"
headerkey="systemlist.jsp.channel" >
+ <%@ include
file="/WEB-INF/pages/common/fragments/channel/channel_list_fragment.jspf" %>
+ </rl:column>
+ <rl:column sortable="false" bound="false"
headerkey="systemlist.jsp.entitlement">
+ <c:out value="${current.entitlementLevel}"
escapeXml="false"/>
+ </rl:column>
+ </rl:list>
+ </rl:listset>
+
+ <html:form action="/systems/ssm/ListPatches">
+ <rhn:csrf />
+ <div align="right">
+ <hr/>
+ <input type="submit" name="back"
value="<bean:message key="ssm.errata.serverlist.return"/>"
/>
+ </div>
+ </html:form>
+ </c:otherwise>
+ </c:choose>
+ </body>
+</html>
diff --git a/java/code/webapp/WEB-INF/struts-config.xml
b/java/code/webapp/WEB-INF/struts-config.xml
index 240567e..58c6247 100644
--- a/java/code/webapp/WEB-INF/struts-config.xml
+++ b/java/code/webapp/WEB-INF/struts-config.xml
@@ -1268,15 +1268,27 @@
<form-property name="lbl" type="java.lang.String" />
<form-property name="timeout" type="java.lang.Long" />
<form-property name="submitted" type="java.lang.Boolean"
/>
- <form-property name="use_date"
type="java.lang.Boolean"/>
- <form-property name="date_year"
type="java.lang.Integer"/>
- <form-property name="date_month"
type="java.lang.Integer"/>
- <form-property name="date_day"
type="java.lang.Integer"/>
- <form-property name="date_hour"
type="java.lang.Integer"/>
- <form-property name="date_minute"
type="java.lang.Integer"/>
- <form-property name="date_am_pm"
type="java.lang.Integer"/>
+ <form-property name="use_date"
type="java.lang.Boolean"/>
+ <form-property name="date_year"
type="java.lang.Integer"/>
+ <form-property name="date_month"
type="java.lang.Integer"/>
+ <form-property name="date_day"
type="java.lang.Integer"/>
+ <form-property name="date_hour"
type="java.lang.Integer"/>
+ <form-property name="date_minute"
type="java.lang.Integer"/>
+ <form-property name="date_am_pm"
type="java.lang.Integer"/>
</form-bean>
+ <form-bean name="SSMPatchListForm"
type="com.redhat.rhn.frontend.struts.ScrubbingDynaActionForm">
+ <form-property name="queue_id" type="java.lang.Long"
/>
+ <form-property name="queue_label" type="java.lang.String"
/>
+ <form-property name="submitted" type="java.lang.Boolean"
/>
+ <form-property name="use_date"
type="java.lang.Boolean"/>
+ <form-property name="date_year"
type="java.lang.Integer"/>
+ <form-property name="date_month"
type="java.lang.Integer"/>
+ <form-property name="date_day"
type="java.lang.Integer"/>
+ <form-property name="date_hour"
type="java.lang.Integer"/>
+ <form-property name="date_minute"
type="java.lang.Integer"/>
+ <form-property name="date_am_pm"
type="java.lang.Integer"/>
+ </form-bean>
</form-beans>
@@ -3554,7 +3566,20 @@
path="/systems/ssm/ListSystems.do"
redirect="true"/>
</action>
- <action path="/systems/ssm/MigrateSystems"
+ <action path="/systems/ssm/ListPatches"
+ scope="request"
+ name="SSMPatchListForm"
+ input="/WEB-INF/pages/ssm/systems/ssm-errata.jsp"
+ type="com.redhat.rhn.frontend.action.ssm.ErrataListAction"
+ className="com.redhat.rhn.frontend.struts.RhnActionMapping">
+ <set-property property="postRequiredIfSubmitted"
value="true" />
+ <forward name="default"
+ path="/WEB-INF/pages/ssm/systems/ssm-errata.jsp" />
+ <forward name="confirm"
+ path="/WEB-INF/pages/ssm/ssmindex.jsp" />
+ </action>
+
+ <action path="/systems/ssm/MigrateSystems"
scope="request"
input="/WEB-INF/pages/ssm/systems/ssmdeleteconfirm.jsp"
type="com.redhat.rhn.frontend.action.ssm.MigrateSystemsAction"
@@ -5096,7 +5121,7 @@
<forward name="default"
path="/WEB-INF/pages/ssm/systems/misc/lock-unlock-system.jsp"
/>
</action>
-
+
<action path="/systems/ssm/misc/RebootSystem"
scope="request"
input="/WEB-INF/pages/ssm/systems/misc/reboot-system.jsp"