diff --git a/java/code/src/com/redhat/rhn/common/conf/ConfigDefaults.java b/java/code/src/com/redhat/rhn/common/conf/ConfigDefaults.java index 246950a5500e..9a3233eaf25a 100644 --- a/java/code/src/com/redhat/rhn/common/conf/ConfigDefaults.java +++ b/java/code/src/com/redhat/rhn/common/conf/ConfigDefaults.java @@ -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 REBOOT_DELAY = "java.reboot_delay"; + /** * Disable SSL redirection */ @@ -1147,4 +1152,20 @@ 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 getRebootDelay() { + int rebootDelay = Config.get().getInt(REBOOT_DELAY, 3); + // A value of 0 would cause a direct shutdown which makes it impossible for salt to return + // the result back, resulting in a failed action. + if (rebootDelay < 1) { + rebootDelay = 1; + } + + return rebootDelay; + } } diff --git a/java/code/src/com/suse/manager/webui/services/SaltServerActionService.java b/java/code/src/com/suse/manager/webui/services/SaltServerActionService.java index f3881187a5cc..297643fd8820 100644 --- a/java/code/src/com/suse/manager/webui/services/SaltServerActionService.java +++ b/java/code/src/com/suse/manager/webui/services/SaltServerActionService.java @@ -1273,10 +1273,11 @@ private Map, List> hardwareRefreshListAction( } private Map, List> rebootAction(List minionSummaries) { + int rebootDelay = ConfigDefaults.get().getRebootDelay(); 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(rebootDelay)) ) ); }