[Spacewalk-devel] [PATCH] Schedule updates for the software update stack first
Hello, attached is patches that will take care that, in case there is an update to the software update stack, it will be scheduled before all other (regular) patch updates. This way we would like to ensure, that if there is bugs in the update stack, they will be fixed before any other patch updates will be installed. Relevant patches are found by inspecting the errata keywords, in this case looking for restart_suggested. Additionally the patches contain the following changes: - All updates to the SW management stack will be combined into a single action for the client, which will also result in one call to zypper/yum on the client. - Duplicated code is removed: The new algorithm exists only in one single place, which is ErrataManager.applyErrata(). - Make the details view show information about all errata attached to an action (2nd patch). Sincerely, Johannes -- SUSE LINUX Products GmbH, HRB 16746 (AG Nürnberg) GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer From b27fdfcda077af488a17d6a2b7a18e133b01909a Mon Sep 17 00:00:00 2001 From: Johannes Renner jren...@suse.de Date: Thu, 18 Oct 2012 17:26:01 +0200 Subject: [PATCH] Schedule updates for software update stack first --- .../action/systems/ErrataConfirmSetupAction.java | 26 --- .../frontend/strings/java/StringResource_en_US.xml |8 +++ .../redhat/rhn/manager/action/ActionManager.java | 54 +++--- .../redhat/rhn/manager/errata/ErrataManager.java | 75 4 files changed, 91 insertions(+), 72 deletions(-) diff --git a/java/code/src/com/redhat/rhn/frontend/action/systems/ErrataConfirmSetupAction.java b/java/code/src/com/redhat/rhn/frontend/action/systems/ErrataConfirmSetupAction.java index 675ce52..3814ea7 100644 --- a/java/code/src/com/redhat/rhn/frontend/action/systems/ErrataConfirmSetupAction.java +++ b/java/code/src/com/redhat/rhn/frontend/action/systems/ErrataConfirmSetupAction.java @@ -15,9 +15,6 @@ package com.redhat.rhn.frontend.action.systems; import com.redhat.rhn.common.util.DatePicker; -import com.redhat.rhn.domain.action.Action; -import com.redhat.rhn.domain.errata.Errata; -import com.redhat.rhn.domain.errata.ErrataFactory; import com.redhat.rhn.domain.rhnset.RhnSet; import com.redhat.rhn.domain.server.Server; import com.redhat.rhn.domain.user.User; @@ -27,7 +24,7 @@ import com.redhat.rhn.frontend.struts.RhnHelper; import com.redhat.rhn.frontend.struts.StrutsDelegate; import com.redhat.rhn.frontend.taglibs.list.helper.ListRhnSetHelper; import com.redhat.rhn.frontend.taglibs.list.helper.Listable; -import com.redhat.rhn.manager.action.ActionManager; +import com.redhat.rhn.manager.errata.ErrataManager; import com.redhat.rhn.manager.system.SystemManager; import org.apache.struts.action.ActionForm; @@ -37,9 +34,13 @@ import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import org.apache.struts.action.DynaActionForm; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -113,16 +114,14 @@ public class ErrataConfirmSetupAction extends RhnAction implements Listable { Server server = SystemManager.lookupByIdAndUser(sid, user); RhnSet set = ErrataSetupAction.getSetDecl(sid).get(user); -ListErrata errataList = ErrataFactory.listErrata(set.getElementValues()); - +// Get the errata IDs +SetLong errataList = set.getElementValues(); if (server != null !errataList.isEmpty()) { - for (Errata e : errataList) { - Action update = ActionManager.createErrataAction(user, e); - ActionManager.addServerToAction(server.getId(), update); - update.setEarliestAction(getStrutsDelegate().readDatePicker(form, date, - DatePicker.YEAR_RANGE_POSITIVE)); - ActionManager.storeAction(update); - } +Date earliest = getStrutsDelegate().readDatePicker(form, date, +DatePicker.YEAR_RANGE_POSITIVE); +ListLong serverIds = Arrays.asList(server.getId()); +ListLong errataIds = new ArrayListLong(errataList); +ErrataManager.applyErrata(user, errataIds, earliest, serverIds); ActionMessages msg = new ActionMessages(); Object[] args = new Object[3]; @@ -153,7 +152,6 @@ public class ErrataConfirmSetupAction extends RhnAction implements Listable { mapping.findForward(RhnHelper.DEFAULT_FORWARD), params); } - /** * Makes a parameter map containing request params that need to * be forwarded on to the success mapping. diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
[Spacewalk-devel] [PATCH] update uptime quickly after reboot
Hi, with the new reboot needed feature introduced some month ago, we realized a small issue. If a patch or package was installed which requires a reboot, the system got the yellow banner on the systems details page. If now a reboot is executed and you look at the page again shortly after the host is up, the banner is still there. The reason is, that the uptime value is updated with first invocation of rhn_check which happen in the default config of rhnsd between 2 and 6 hours after rhnsd is started or in case of osad running when the first action is scheduled. We cannot simply change rhnsd to do the first check immediately after start. In case actions are scheduled, they will be executed during the boot process and nobody knows if everything is up and running. I developed a set of patches (attached) to fix this issue: 1) add a new XMLRPC function queue.update_status(), which only get the status report of a system and update the database. It uses the same funcations as get() is using. 2) add a new tool rhn-update-status to rhn-client-tools which send the status 3) change the init scripts of rhnsd to call rhn-update-status during start. -- Regards Michael Calmer -- Michael Calmer SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nuernberg T: +49 (0) 911 74053 0 F: +49 (0) 911 74053575 - e-mail: michael.cal...@suse.com -- SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer HRB 16746 (AG Nürnberg) From 1c3b6b6a16d59305e44125467c7dc43ca152b289 Mon Sep 17 00:00:00 2001 From: Michael Calmer m...@suse.de Date: Thu, 18 Oct 2012 17:40:47 +0200 Subject: [PATCH 1/4] add xmlrpc function update_status and server capability --- backend/server/handlers/xmlrpc/queue.py | 12 backend/server/rhnCapability.py |1 + 2 Dateien geändert, 13 Zeilen hinzugefügt(+) diff --git a/backend/server/handlers/xmlrpc/queue.py b/backend/server/handlers/xmlrpc/queue.py index 4240d92..9fdc6d4 100644 --- a/backend/server/handlers/xmlrpc/queue.py +++ b/backend/server/handlers/xmlrpc/queue.py @@ -44,6 +44,7 @@ class Queue(rhnHandler): self.functions.append('get_future_actions') self.functions.append('length') self.functions.append('submit') +self.functions.append('update_status') # XXX I am not proud of this. There should be a generic way to map # the client's error codes into success status codes @@ -473,6 +474,17 @@ class Queue(rhnHandler): rhnSQL.commit() return 0 +def update_status(self, system_id, status = {}): +# Authenticate the system certificate +self.auth_system(system_id) +log_debug(1, self.server_id, status) +if status: +self.__update_status(status) +# commit all changes +rhnSQL.commit() + +return 0 + def status_for_action_type_code(self, action_type, rcode): Convert whatever the client sends as a result code into a status in the database format diff --git a/backend/server/rhnCapability.py b/backend/server/rhnCapability.py index 9f2a82f..014f6a5 100644 --- a/backend/server/rhnCapability.py +++ b/backend/server/rhnCapability.py @@ -167,6 +167,7 @@ def _set_server_capabilities(): 'staging_content' : {'version' : 1, 'value' : 1}, 'ipv6' : {'version' : 1, 'value' : 1}, 'abrt.handle' : {'version' : 1, 'value' : 1}, +'queue.update_status' : {'version' : 1, 'value' : 1}, } l = [] for name, hashval in capabilities.items(): -- 1.7.10.4 From 2dbb54f64666efcb6f0b6676d200d874c1cbe40e Mon Sep 17 00:00:00 2001 From: Michael Calmer m...@suse.de Date: Thu, 18 Oct 2012 17:42:08 +0200 Subject: [PATCH 2/4] new script rhn-update-status to update the uptime and kernelver on the server --- client/rhel/rhn-client-tools/rhn-client-tools.spec |1 + client/rhel/rhn-client-tools/src/bin/Makefile | 13 ++--- .../rhn-client-tools/src/bin/rhn-update-status.py | 51 3 Dateien geändert, 59 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-) create mode 100755 client/rhel/rhn-client-tools/src/bin/rhn-update-status.py diff --git a/client/rhel/rhn-client-tools/rhn-client-tools.spec b/client/rhel/rhn-client-tools/rhn-client-tools.spec index 180b6e1..06a6ede 100644 --- a/client/rhel/rhn-client-tools/rhn-client-tools.spec +++ b/client/rhel/rhn-client-tools/rhn-client-tools.spec @@ -246,6 +246,7 @@ make -f Makefile.rhn-client-tools test %{_mandir}/man8/rhn_check.8* %{_sbindir}/rhn_check +%{_sbindir}/rhn-update-status %{_datadir}/rhn/up2date_client/getMethod.* diff --git a/client/rhel/rhn-client-tools/src/bin/Makefile b/client/rhel/rhn-client-tools/src/bin/Makefile index