From 204408f66675d5acc4dcc0ad1dd7abaab870bf76d896ce0f837063be3755bbf3 Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Fri, 19 Jan 2024 19:21:21 +0000 Subject: [PATCH] - Add cloud-init-pckg-reboot.patch (boo#1198533, bsc#1218952) + 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 --- cloud-init-pckg-reboot.patch | 28 ++++++++++++++++++++++++++++ cloud-init.changes | 6 ++++++ cloud-init.spec | 3 +++ 3 files changed, 37 insertions(+) create mode 100644 cloud-init-pckg-reboot.patch diff --git a/cloud-init-pckg-reboot.patch b/cloud-init-pckg-reboot.patch new file mode 100644 index 0000000..2df676b --- /dev/null +++ b/cloud-init-pckg-reboot.patch @@ -0,0 +1,28 @@ +--- 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) diff --git a/cloud-init.changes b/cloud-init.changes index 89bc457..c8c81af 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jan 19 19:19:49 UTC 2024 - Robert Schweikert + +- Add cloud-init-pckg-reboot.patch (boo#1198533, bsc#1218952) + + Support reboot on package update/upgrade via the cloud-init config + ------------------------------------------------------------------- Fri Dec 15 14:09:36 UTC 2023 - Robert Schweikert diff --git a/cloud-init.spec b/cloud-init.spec index 690a318..2bbe57c 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -39,6 +39,8 @@ Patch6: cloud-init-write-routes.patch # FIXME (https://github.com/canonical/cloud-init/issues/4339) Patch7: cloud-init-keep-flake.patch Patch8: cloud-init-lint-fixes.patch +# FIXME (https://github.com/canonical/cloud-init/pull/4788) +Patch9: cloud-init-pckg-reboot.patch BuildRequires: fdupes BuildRequires: filesystem # pkg-config is needed to find correct systemd unit dir @@ -145,6 +147,7 @@ Documentation and examples for cloud-init tools %patch6 %patch7 %patch8 +%patch9 # patch in the full version to version.py version_pys=$(find . -name version.py -type f)