This is just a small follow up patch which makes the list conversion obsolete.
Thanks, Johannes On 10/19/2012 11:01 AM, Johannes Renner wrote: > 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 96a54478df6773d7c3232417dc6bef425d266859 Mon Sep 17 00:00:00 2001 From: Johannes Renner <jren...@suse.de> Date: Fri, 19 Oct 2012 13:21:03 +0200 Subject: [PATCH] Make applyErrata() work with Longs and Integers --- .../redhat/rhn/manager/errata/ErrataManager.java | 21 +++++++------------- 1 file changed, 7 insertions(+), 14 deletions(-) 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 a7fc9ce..4610f7e 100644 --- a/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java +++ b/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java @@ -1328,7 +1328,7 @@ public class ErrataManager extends BaseManager { } // at this point all errata is applicable to all systems, so let's apply - applyErrata(loggedInUser, convertToLongs(errataIds), earliestOccurrence, systemIds); + applyErrata(loggedInUser, errataIds, earliestOccurrence, systemIds); } private static void checkApplicableErrata(User loggedInUser, List<Integer> errataIds, @@ -1359,12 +1359,16 @@ public class ErrataManager extends BaseManager { * @param earliest * @param serverIds */ - public static void applyErrata(User user, List<Long> errataIds, Date earliest, + public static void applyErrata(User user, List errataIds, Date earliest, List<Long> serverIds) { // Schedule updates to the software update stack first ErrataAction swStackUpdate = null; List<Errata> errata = new ArrayList<Errata>(); - for (Long currentId : errataIds) { + for (Iterator it = errataIds.iterator(); it.hasNext();) { + Object next = it.next(); + Long currentId = next instanceof Long ? (Long) next : + ((Integer) next).longValue(); + Errata erratum = ErrataManager.lookupErrata(currentId, user); if (erratum.hasKeyword("restart_suggested")) { if (swStackUpdate == null) { @@ -1405,15 +1409,4 @@ public class ErrataManager extends BaseManager { } return (ErrataAction) update; } - - /** - * Convert a list of {@link Integer} to a list of {@link Long}. - */ - private static List<Long> convertToLongs(List<Integer> list) { - List<Long> ret = new ArrayList<Long>(); - for (Integer i : list) { - ret.add(i.longValue()); - } - return ret; - } } -- 1.7.10.4
_______________________________________________ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel