Skip to content

Commit

Permalink
Add a config to specify the number of minutes to wait before performi…
Browse files Browse the repository at this point in the history
…ng a system reboot
  • Loading branch information
HoussemNasri committed Oct 21, 2023
1 parent 36b8ccb commit 5070207
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions java/code/src/com/redhat/rhn/common/conf/ConfigDefaults.java
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ public class ConfigDefaults {
*/
public static final String UNIFY_CUSTOM_CHANNEL_MANAGEMENT = "java.unify_custom_channel_management";

/**
* Specify the number of minutes to wait before performing a system reboot
* */
public static final String MINUTES_TO_WAIT_BEFORE_REBOOT = "minutes_to_wait_before_reboot";

/**
* Disable SSL redirection
*/
Expand Down Expand Up @@ -1147,4 +1152,12 @@ public boolean isSsl() {
public long getRhuiDefaultOrgId() {
return Config.get().getInt(RHUI_DEFAULT_ORG_ID, 1);
}

/**
* Returns the number of minutes to wait before performing a system reboot
* @return the minutes to wait before a system reboot
* */
public int getMinutesToWaitBeforeReboot() {
return Config.get().getInt(MINUTES_TO_WAIT_BEFORE_REBOOT, 3);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1273,10 +1273,11 @@ private Map<LocalCall<?>, List<MinionSummary>> hardwareRefreshListAction(
}

private Map<LocalCall<?>, List<MinionSummary>> rebootAction(List<MinionSummary> minionSummaries) {
int minutesToWaitBeforeReboot = ConfigDefaults.get().getMinutesToWaitBeforeReboot();
return minionSummaries.stream().collect(
Collectors.groupingBy(
m -> m.isTransactionalUpdate() ? TransactionalUpdate.reboot() :
com.suse.salt.netapi.calls.modules.System.reboot(Optional.of(3))
com.suse.salt.netapi.calls.modules.System.reboot(Optional.of(minutesToWaitBeforeReboot))
)
);
}
Expand Down

0 comments on commit 5070207

Please sign in to comment.