Skip to content

Commit

Permalink
fixes updated packages list when a SLE micro gets updated (bsc#1227118)
Browse files Browse the repository at this point in the history
  • Loading branch information
CDellaGiusta committed Jan 9, 2025
1 parent 01f82ce commit cfc320a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -350,6 +351,7 @@ private void applyMinionStartStates(String minionId, MinionServer registeredMini
MinionList minionTarget = new MinionList(minionId);
saltApi.updateSystemInfo(minionTarget);
scheduleCoCoAttestation(registeredMinion);
schedulePackageListRefresh(registeredMinion);
}
}

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fixes: updated packages list when a SLE micro
gets updated (bsc#1227118)

0 comments on commit cfc320a

Please sign in to comment.