From 8d527f3de5c36f46494ad61d8046b1989b11cf1e Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 28 Feb 2023 07:55:03 +0000 Subject: [PATCH] import cloud-init-22.1-7.el9_1 --- ...eady-before-cloud-init-service-runs-.patch | 43 ++++++++++ ...ignore-var-lib-cloud-data-set-hostna.patch | 84 +++++++++++++++++++ SPECS/cloud-init.spec | 16 +++- 3 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 SOURCES/ci-Ensure-network-ready-before-cloud-init-service-runs-.patch create mode 100644 SOURCES/ci-cc_set_hostname-ignore-var-lib-cloud-data-set-hostna.patch diff --git a/SOURCES/ci-Ensure-network-ready-before-cloud-init-service-runs-.patch b/SOURCES/ci-Ensure-network-ready-before-cloud-init-service-runs-.patch new file mode 100644 index 0000000..43a9ae4 --- /dev/null +++ b/SOURCES/ci-Ensure-network-ready-before-cloud-init-service-runs-.patch @@ -0,0 +1,43 @@ +From 799ef819e75bdddbf4e983e6990a6a6a51c61bdb Mon Sep 17 00:00:00 2001 +From: Emanuele Giuseppe Esposito +Date: Wed, 14 Dec 2022 09:21:32 +0100 +Subject: [PATCH] Ensure network ready before cloud-init service runs on RHEL + (#1893) + +RH-Author: Emanuele Giuseppe Esposito +RH-MergeRequest: 85: Ensure network ready before cloud-init service runs on RHEL (#1893) +RH-Bugzilla: 2153183 +RH-Acked-by: Mohamed Gamal Morsy +RH-Acked-by: Camilla Conte +RH-Commit: [1/1] d1abf2692aeddea9eac69f6ff8b173e188c3e013 + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2153183 + +commit 6e725f36647407d201af0603d7db11fc96a93d4d +Author: James Falcon +Date: Tue Dec 13 10:55:23 2022 -0600 + + Ensure network ready before cloud-init service runs on RHEL (#1893) + + LP: #1998655 + +Signed-off-by: Emanuele Giuseppe Esposito +--- + systemd/cloud-init.service.tmpl | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl +index c170aef7..fc984d5c 100644 +--- a/systemd/cloud-init.service.tmpl ++++ b/systemd/cloud-init.service.tmpl +@@ -16,6 +16,7 @@ After=networking.service + "miraclelinux", "openEuler", "rhel", "rocky", "virtuozzo"] %} + After=network.service + After=NetworkManager.service ++After=NetworkManager-wait-online.service + {% endif %} + {% if variant in ["suse"] %} + After=wicked.service +-- +2.38.1 + diff --git a/SOURCES/ci-cc_set_hostname-ignore-var-lib-cloud-data-set-hostna.patch b/SOURCES/ci-cc_set_hostname-ignore-var-lib-cloud-data-set-hostna.patch new file mode 100644 index 0000000..4ea2d35 --- /dev/null +++ b/SOURCES/ci-cc_set_hostname-ignore-var-lib-cloud-data-set-hostna.patch @@ -0,0 +1,84 @@ +From c7ad2c8d1ddddcb9acaa1ffebb8e3b9752201f91 Mon Sep 17 00:00:00 2001 +From: Emanuele Giuseppe Esposito +Date: Tue, 31 Jan 2023 15:28:33 +0100 +Subject: [PATCH] cc_set_hostname: ignore /var/lib/cloud/data/set-hostname if + it's empty (#1967) + +RH-Author: Emanuele Giuseppe Esposito +RH-MergeRequest: 89: cc_set_hostname: ignore /var/lib/cloud/data/set-hostname if it's empty (#1967) +RH-Bugzilla: 2165942 +RH-Acked-by: Mohamed Gamal Morsy +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/1] 53809c47b4d7f5b30cbeb2903a48f1ee42f68c53 + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165942 + +commit 9c7502a801763520639c66125eb373123d1e4f44 +Author: Emanuele Giuseppe Esposito +Date: Wed Jan 18 17:55:16 2023 +0100 + + cc_set_hostname: ignore /var/lib/cloud/data/set-hostname if it's empty (#1967) + + If the file exists but is empty, do nothing. + Otherwise cloud-init will crash because it does not handle the empty file. + + RHBZ: 2140893 + + Signed-off-by: Emanuele Giuseppe Esposito + +Signed-off-by: Emanuele Giuseppe Esposito +--- + cloudinit/config/cc_set_hostname.py | 2 +- + tests/unittests/config/test_cc_set_hostname.py | 17 +++++++++++++++++ + 2 files changed, 18 insertions(+), 1 deletion(-) + +diff --git a/cloudinit/config/cc_set_hostname.py b/cloudinit/config/cc_set_hostname.py +index 2674fa20..7e3d5b74 100644 +--- a/cloudinit/config/cc_set_hostname.py ++++ b/cloudinit/config/cc_set_hostname.py +@@ -86,7 +86,7 @@ def handle(name, cfg, cloud, log, _args): + # distro._read_hostname implementation so we only validate one artifact. + prev_fn = os.path.join(cloud.get_cpath("data"), "set-hostname") + prev_hostname = {} +- if os.path.exists(prev_fn): ++ if os.path.exists(prev_fn) and os.stat(prev_fn).st_size > 0: + prev_hostname = util.load_json(util.load_file(prev_fn)) + hostname_changed = hostname != prev_hostname.get( + "hostname" +diff --git a/tests/unittests/config/test_cc_set_hostname.py b/tests/unittests/config/test_cc_set_hostname.py +index 3d1d86ee..2c92949f 100644 +--- a/tests/unittests/config/test_cc_set_hostname.py ++++ b/tests/unittests/config/test_cc_set_hostname.py +@@ -5,6 +5,7 @@ import os + import shutil + import tempfile + from io import BytesIO ++from pathlib import Path + from unittest import mock + + from configobj import ConfigObj +@@ -242,5 +243,21 @@ class TestHostname(t_help.FilesystemMockingTestCase): + str(ctx_mgr.exception), + ) + ++ def test_ignore_empty_previous_artifact_file(self): ++ cfg = { ++ "hostname": "blah", ++ "fqdn": "blah.blah.blah.yahoo.com", ++ } ++ distro = self._fetch_distro("debian") ++ paths = helpers.Paths({"cloud_dir": self.tmp}) ++ ds = None ++ cc = cloud.Cloud(ds, paths, {}, distro, None) ++ self.patchUtils(self.tmp) ++ prev_fn = Path(cc.get_cpath("data")) / "set-hostname" ++ prev_fn.touch() ++ cc_set_hostname.handle("cc_set_hostname", cfg, cc, LOG, []) ++ contents = util.load_file("/etc/hostname") ++ self.assertEqual("blah", contents.strip()) ++ + + # vi: ts=4 expandtab +-- +2.39.1 + diff --git a/SPECS/cloud-init.spec b/SPECS/cloud-init.spec index f0f9c43..7e3e108 100644 --- a/SPECS/cloud-init.spec +++ b/SPECS/cloud-init.spec @@ -1,6 +1,6 @@ Name: cloud-init Version: 22.1 -Release: 5%{?dist} +Release: 7%{?dist} Summary: Cloud instance init scripts License: ASL 2.0 or GPLv3 URL: http://launchpad.net/cloud-init @@ -46,6 +46,10 @@ Patch17: ci-Revert-Use-Network-Manager-and-Netplan-as-default-re.patch # For bz#2117532 - [RHEL9.1] Revert patch of configuring networking by NM keyfiles # For bz#2098501 - [RHEL-9.1] IPv6 not workable when cloud-init configure network using NM keyfiles Patch18: ci-Revert-Revert-Setting-highest-autoconnect-priority-f.patch +# For bz#2153183 - [RHEL-9] Ensure network ready before cloud-init service runs on RHEL [rhel-9.1.0.z] +Patch19: ci-Ensure-network-ready-before-cloud-init-service-runs-.patch +# For bz#2165942 - systemd[1]: Failed to start Initial cloud-init job after reboot system via sysrq 'b' [RHEL-9] [rhel-9.1.0.z] +Patch20: ci-cc_set_hostname-ignore-var-lib-cloud-data-set-hostna.patch # Source-git patches @@ -236,6 +240,16 @@ fi %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %changelog +* Wed Feb 08 2023 Camilla Conte - 22.1-7.el9_1 +- ci-cc_set_hostname-ignore-var-lib-cloud-data-set-hostna.patch [bz#2165942] +- Resolves: bz#2165942 + (systemd[1]: Failed to start Initial cloud-init job after reboot system via sysrq 'b' [RHEL-9] [rhel-9.1.0.z]) + +* Thu Dec 22 2022 Camilla Conte - 22.1-6 +- ci-Ensure-network-ready-before-cloud-init-service-runs-.patch [bz#2153183] +- Resolves: bz#2153183 + ([RHEL-9] Ensure network ready before cloud-init service runs on RHEL [rhel-9.1.0.z]) + * Wed Aug 17 2022 Miroslav Rezanina - 22.1-5 - ci-Revert-Add-native-NetworkManager-support-1224.patch [bz#2107463 bz#2104389 bz#2117532 bz#2098501] - ci-Revert-Use-Network-Manager-and-Netplan-as-default-re.patch [bz#2107463 bz#2104389 bz#2117532 bz#2098501]