diff --git a/bundles/apt/files/check_unattended_upgrades b/bundles/apt/files/check_unattended_upgrades index aa315ce..ba0044f 100644 --- a/bundles/apt/files/check_unattended_upgrades +++ b/bundles/apt/files/check_unattended_upgrades @@ -21,6 +21,10 @@ case "$exitcode" in echo "Upgrades skipped due to active SSH login" exit 1 ;; + reboot) + echo "Upgrades require a reboot, but automatic rebooting is disabled" + exit 1 + ;; 0) echo "OK" exit 0 diff --git a/bundles/apt/files/upgrade-and-reboot b/bundles/apt/files/upgrade-and-reboot index 22c93a7..6c382f1 100644 --- a/bundles/apt/files/upgrade-and-reboot +++ b/bundles/apt/files/upgrade-and-reboot @@ -46,11 +46,16 @@ fi if [[ -f /var/run/reboot-required ]] then - if [[ -n "$reboot_mail_to" ]] + if [[ "$auto_reboot_enabled" == "False" ]] then - date | mail -s "SYSREBOOTNOW $nodename" "$reboot_mail_to" + echo "reboot" > "$statusfile" + else + if [[ -n "$reboot_mail_to" ]] + then + date | mail -s "SYSREBOOTNOW $nodename" "$reboot_mail_to" + fi + systemctl reboot fi - systemctl reboot -else - echo "upgrade-and-reboot for node $nodename is DONE" fi + +echo "upgrade-and-reboot for node $nodename is DONE" diff --git a/bundles/apt/files/upgrade-and-reboot.conf b/bundles/apt/files/upgrade-and-reboot.conf index e973246..9bfbd39 100644 --- a/bundles/apt/files/upgrade-and-reboot.conf +++ b/bundles/apt/files/upgrade-and-reboot.conf @@ -1,2 +1,3 @@ nodename="${node.name}" reboot_mail_to="${node.metadata.get('apt/unattended-upgrades/reboot_mail_to', '')}" +auto_reboot_enabled="${node.metadata.get('apt/unattended-upgrades/reboot-enabled', True)}"