forked from pool/cloud-init
Robert Schweikert
204408f666
+ Support reboot on package update/upgrade via the cloud-init config OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=221
29 lines
1.2 KiB
Diff
29 lines
1.2 KiB
Diff
--- cloudinit/config/cc_package_update_upgrade_install.py.orig
|
|
+++ cloudinit/config/cc_package_update_upgrade_install.py
|
|
@@ -18,7 +18,7 @@ from cloudinit.config.schema import Meta
|
|
from cloudinit.distros import ALL_DISTROS
|
|
from cloudinit.settings import PER_INSTANCE
|
|
|
|
-REBOOT_FILE = "/var/run/reboot-required"
|
|
+REBOOT_FILES = ("/var/run/reboot-required", "/run/reboot-needed")
|
|
REBOOT_CMD = ["/sbin/reboot"]
|
|
|
|
MODULE_DESCRIPTION = """\
|
|
@@ -120,11 +120,14 @@ def handle(name: str, cfg: Config, cloud
|
|
# kernel and openssl (possibly some other packages)
|
|
# write a file /var/run/reboot-required after upgrading.
|
|
# if that file exists and configured, then just stop right now and reboot
|
|
- reboot_fn_exists = os.path.isfile(REBOOT_FILE)
|
|
+ for reboot_marker in REBOOT_FILES:
|
|
+ reboot_fn_exists = os.path.isfile(reboot_marker)
|
|
+ if reboot_fn_exists:
|
|
+ break
|
|
if (upgrade or pkglist) and reboot_if_required and reboot_fn_exists:
|
|
try:
|
|
LOG.warning(
|
|
- "Rebooting after upgrade or install per %s", REBOOT_FILE
|
|
+ "Rebooting after upgrade or install per %s", reboot_marker
|
|
)
|
|
# Flush the above warning + anything else out...
|
|
logging.flushLoggers(LOG)
|