diff --git a/java/code/src/com/suse/manager/reactor/messaging/RegisterMinionEventMessageAction.java b/java/code/src/com/suse/manager/reactor/messaging/RegisterMinionEventMessageAction.java index e92049fb3c08..2d2ec34233bd 100644 --- a/java/code/src/com/suse/manager/reactor/messaging/RegisterMinionEventMessageAction.java +++ b/java/code/src/com/suse/manager/reactor/messaging/RegisterMinionEventMessageAction.java @@ -51,6 +51,7 @@ import com.redhat.rhn.domain.token.ActivationKeyFactory; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.dto.EssentialChannelDto; +import com.redhat.rhn.manager.action.ActionManager; import com.redhat.rhn.manager.distupgrade.DistUpgradeManager; import com.redhat.rhn.manager.entitlement.EntitlementManager; import com.redhat.rhn.manager.formula.FormulaMonitoringManager; @@ -350,6 +351,7 @@ private void applyMinionStartStates(String minionId, MinionServer registeredMini MinionList minionTarget = new MinionList(minionId); saltApi.updateSystemInfo(minionTarget); scheduleCoCoAttestation(registeredMinion); + schedulePackageListRefresh(registeredMinion); } } @@ -380,6 +382,29 @@ private void scheduleCoCoAttestation(MinionServer minion) { } } + /** + * Schedule a package list refresh when the minion supports transactional update + * + * @param minion the minion + */ + private void schedulePackageListRefresh(MinionServer minion) { + if (!minion.doesOsSupportsTransactionalUpdate()) { + // no package list refresh wanted on startup + return; + } + + try { + // eariest 1 minute later to finish the boot process + // randomize a bit to prevent a package list refresh storm on a mass reboot action + int rand = ThreadLocalRandom.current().nextInt(60, 90); + Date scheduleAt = Date.from(Instant.now().plus(rand, ChronoUnit.SECONDS)); + ActionManager.schedulePackageRefresh(Optional.empty(), minion, scheduleAt); + } + catch (TaskomaticApiException e) { + LOG.error("Unable to schedule package list refresh action. ", e); + } + } + /** * Reactivate the system * @param minionId minion id of the minion diff --git a/java/spacewalk-java.changes.carlo.Manager-5.0-sle-micro-update b/java/spacewalk-java.changes.carlo.Manager-5.0-sle-micro-update new file mode 100644 index 000000000000..cd0ab423dfb9 --- /dev/null +++ b/java/spacewalk-java.changes.carlo.Manager-5.0-sle-micro-update @@ -0,0 +1,2 @@ +- Fixes: updated packages list when a SLE micro + gets updated (bsc#1227118)