From e3789db183132a32e066dd67dfb50fd45e77a123 Mon Sep 17 00:00:00 2001 From: Camilla Conte Date: Tue, 18 Apr 2023 10:01:55 +0000 Subject: [PATCH] * Tue Apr 18 2023 Camilla Conte - 23.1.1-2 - 0007-rhel-make-sure-previous-hostname-file-ends-with-a-ne.patch [bz#2184608] - Resolves: bz#2184608 --- 0001-Add-initial-redhat-changes.patch | 4 +- ...CONTROLLED-no-in-generated-interface.patch | 6 +- ...autoconnect-priority-for-network-scr.patch | 4 +- 0004-limit-permissions-on-def_log_file.patch | 8 +-- ...e-Network-Manager-and-Netplan-as-def.patch | 8 +-- ...d-native-NetworkManager-support-1224.patch | 16 +++--- ...revious-hostname-file-ends-with-a-ne.patch | 57 +++++++++++++++++++ cloud-init.spec | 7 ++- 8 files changed, 86 insertions(+), 24 deletions(-) create mode 100644 0007-rhel-make-sure-previous-hostname-file-ends-with-a-ne.patch diff --git a/0001-Add-initial-redhat-changes.patch b/0001-Add-initial-redhat-changes.patch index 9ba25e6..fcbcf09 100644 --- a/0001-Add-initial-redhat-changes.patch +++ b/0001-Add-initial-redhat-changes.patch @@ -1,7 +1,7 @@ From c4d66915520554adedff9be7396f877cd1a5525c Mon Sep 17 00:00:00 2001 From: Emanuele Giuseppe Esposito Date: Mon, 6 Mar 2023 16:37:20 +0100 -Subject: [PATCH 1/6] Add initial redhat changes +Subject: [PATCH 1/7] Add initial redhat changes Adding minimal set of changes necessary for successful build of the package on RHEL/CentOS 9 Stream koji. @@ -39,7 +39,7 @@ Signed-off-by: Emanuele Giuseppe Esposito 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cloudinit/settings.py b/cloudinit/settings.py -index 8684d0039..edbb217d3 100644 +index 8684d003..edbb217d 100644 --- a/cloudinit/settings.py +++ b/cloudinit/settings.py @@ -53,13 +53,14 @@ CFG_BUILTIN = { diff --git a/0002-Do-not-write-NM_CONTROLLED-no-in-generated-interface.patch b/0002-Do-not-write-NM_CONTROLLED-no-in-generated-interface.patch index 8b4d554..baa9671 100644 --- a/0002-Do-not-write-NM_CONTROLLED-no-in-generated-interface.patch +++ b/0002-Do-not-write-NM_CONTROLLED-no-in-generated-interface.patch @@ -1,7 +1,7 @@ From b3b96bff187e9d0bfcbfefd5fca05c61bd50d368 Mon Sep 17 00:00:00 2001 From: Eduardo Otubo Date: Fri, 7 May 2021 13:36:06 +0200 -Subject: [PATCH 2/6] Do not write NM_CONTROLLED=no in generated interface +Subject: [PATCH 2/7] Do not write NM_CONTROLLED=no in generated interface config files Conflicts 20.3: @@ -21,7 +21,7 @@ Signed-off-by: Ryan McCabe 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py -index d4daa78f0..a7dbe55b4 100644 +index d4daa78f..a7dbe55b 100644 --- a/cloudinit/net/sysconfig.py +++ b/cloudinit/net/sysconfig.py @@ -316,7 +316,6 @@ class Renderer(renderer.Renderer): @@ -51,7 +51,7 @@ index d4daa78f0..a7dbe55b4 100644 netcfg.append("NETWORKING_IPV6=yes") netcfg.append("IPV6_AUTOCONF=no") diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py -index 056aaeb6f..0f523ff84 100644 +index 056aaeb6..0f523ff8 100644 --- a/tests/unittests/test_net.py +++ b/tests/unittests/test_net.py @@ -585,7 +585,6 @@ GATEWAY=172.19.3.254 diff --git a/0003-Setting-highest-autoconnect-priority-for-network-scr.patch b/0003-Setting-highest-autoconnect-priority-for-network-scr.patch index 75327e6..1097771 100644 --- a/0003-Setting-highest-autoconnect-priority-for-network-scr.patch +++ b/0003-Setting-highest-autoconnect-priority-for-network-scr.patch @@ -1,7 +1,7 @@ From c589da20eb92231ef08e10c9724e3e6c663e6ce2 Mon Sep 17 00:00:00 2001 From: Eduardo Otubo Date: Thu, 17 Feb 2022 15:32:35 +0100 -Subject: [PATCH 3/6] Setting highest autoconnect priority for network-scripts +Subject: [PATCH 3/7] Setting highest autoconnect priority for network-scripts RH-Author: Eduardo Otubo RH-MergeRequest: 22: Setting highest autoconnect priority for network-scripts @@ -29,7 +29,7 @@ Signed-off-by: Eduardo Otubo 1 file changed, 1 insertion(+) diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py -index a7dbe55b4..4262cd489 100644 +index a7dbe55b..4262cd48 100644 --- a/cloudinit/net/sysconfig.py +++ b/cloudinit/net/sysconfig.py @@ -317,6 +317,7 @@ class Renderer(renderer.Renderer): diff --git a/0004-limit-permissions-on-def_log_file.patch b/0004-limit-permissions-on-def_log_file.patch index b2b76c6..3020816 100644 --- a/0004-limit-permissions-on-def_log_file.patch +++ b/0004-limit-permissions-on-def_log_file.patch @@ -1,7 +1,7 @@ From dfff374f66904e84fb07ca157ba010fac6b5f1de Mon Sep 17 00:00:00 2001 From: Eduardo Otubo Date: Fri, 7 May 2021 13:36:08 +0200 -Subject: [PATCH 4/6] limit permissions on def_log_file +Subject: [PATCH 4/7] limit permissions on def_log_file This sets a default mode of 0600 on def_log_file, and makes this configurable via the def_log_file_mode option in cloud.cfg. @@ -25,7 +25,7 @@ Signed-off-by: Eduardo Otubo 3 files changed, 6 insertions(+) diff --git a/cloudinit/settings.py b/cloudinit/settings.py -index edbb217d3..3d5411412 100644 +index edbb217d..3d541141 100644 --- a/cloudinit/settings.py +++ b/cloudinit/settings.py @@ -52,6 +52,7 @@ CFG_BUILTIN = { @@ -37,7 +37,7 @@ index edbb217d3..3d5411412 100644 "mount_default_fields": [None, None, "auto", "defaults,nofail", "0", "2"], "syslog_fix_perms": [], diff --git a/cloudinit/stages.py b/cloudinit/stages.py -index 9494a0bfa..a624a6fb2 100644 +index 9494a0bf..a624a6fb 100644 --- a/cloudinit/stages.py +++ b/cloudinit/stages.py @@ -202,6 +202,7 @@ class Init: @@ -49,7 +49,7 @@ index 9494a0bfa..a624a6fb2 100644 util.ensure_file(log_file, mode=0o640, preserve_mode=True) perms = self.cfg.get("syslog_fix_perms") diff --git a/doc/examples/cloud-config.txt b/doc/examples/cloud-config.txt -index 15d788f38..b6d16c9c3 100644 +index 15d788f3..b6d16c9c 100644 --- a/doc/examples/cloud-config.txt +++ b/doc/examples/cloud-config.txt @@ -383,10 +383,14 @@ timezone: US/Eastern diff --git a/0005-Manual-revert-Use-Network-Manager-and-Netplan-as-def.patch b/0005-Manual-revert-Use-Network-Manager-and-Netplan-as-def.patch index f0aa07d..f9c95ff 100644 --- a/0005-Manual-revert-Use-Network-Manager-and-Netplan-as-def.patch +++ b/0005-Manual-revert-Use-Network-Manager-and-Netplan-as-def.patch @@ -1,7 +1,7 @@ From ecae81f98ce230266eb99671b74534a4ede660f0 Mon Sep 17 00:00:00 2001 From: Emanuele Giuseppe Esposito Date: Fri, 10 Mar 2023 11:51:48 +0100 -Subject: [PATCH 5/6] Manual revert "Use Network-Manager and Netplan as default +Subject: [PATCH 5/7] Manual revert "Use Network-Manager and Netplan as default renderers for RHEL and Fedora (#1465)" This reverts changes done in commit 7703aa98b. @@ -17,7 +17,7 @@ Signed-off-by: Emanuele Giuseppe Esposito 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/cloudinit/net/renderers.py b/cloudinit/net/renderers.py -index fcf7febad..b241683f9 100644 +index fcf7feba..b241683f 100644 --- a/cloudinit/net/renderers.py +++ b/cloudinit/net/renderers.py @@ -30,7 +30,6 @@ DEFAULT_PRIORITY = [ @@ -29,7 +29,7 @@ index fcf7febad..b241683f9 100644 "netbsd", "openbsd", diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl -index 7238c1021..12f32c516 100644 +index 7238c102..12f32c51 100644 --- a/config/cloud.cfg.tmpl +++ b/config/cloud.cfg.tmpl @@ -381,9 +381,6 @@ system_info: @@ -43,7 +43,7 @@ index 7238c1021..12f32c516 100644 network: renderers: ['network-manager', 'networkd'] diff --git a/doc/rtd/reference/network-config.rst b/doc/rtd/reference/network-config.rst -index ea331f1cb..bc52afa5f 100644 +index ea331f1c..bc52afa5 100644 --- a/doc/rtd/reference/network-config.rst +++ b/doc/rtd/reference/network-config.rst @@ -176,16 +176,6 @@ this state, ``cloud-init`` delegates rendering of the configuration to diff --git a/0006-Revert-Add-native-NetworkManager-support-1224.patch b/0006-Revert-Add-native-NetworkManager-support-1224.patch index 49a5926..ce42877 100644 --- a/0006-Revert-Add-native-NetworkManager-support-1224.patch +++ b/0006-Revert-Add-native-NetworkManager-support-1224.patch @@ -1,7 +1,7 @@ From b1dd14ffafad2d2ca84326c525962b2ca086b292 Mon Sep 17 00:00:00 2001 From: Ani Sinha Date: Wed, 22 Mar 2023 16:31:58 +0530 -Subject: [PATCH 6/6] Revert "Add native NetworkManager support (#1224)" +Subject: [PATCH 6/7] Revert "Add native NetworkManager support (#1224)" This reverts commit feda344e6cf9d37b09bc13cf333a717d1654c26c. @@ -18,7 +18,7 @@ Signed-off-by: Ani Sinha delete mode 100644 cloudinit/net/network_manager.py diff --git a/cloudinit/cmd/devel/net_convert.py b/cloudinit/cmd/devel/net_convert.py -index eee498601..1a0a31acf 100755 +index eee49860..1a0a31ac 100755 --- a/cloudinit/cmd/devel/net_convert.py +++ b/cloudinit/cmd/devel/net_convert.py @@ -10,14 +10,7 @@ import sys @@ -57,7 +57,7 @@ index eee498601..1a0a31acf 100755 raise RuntimeError("Invalid output_kind") diff --git a/cloudinit/net/activators.py b/cloudinit/net/activators.py -index 7d11a02c7..d9a8c4d76 100644 +index 7d11a02c..d9a8c4d7 100644 --- a/cloudinit/net/activators.py +++ b/cloudinit/net/activators.py @@ -1,14 +1,15 @@ @@ -121,7 +121,7 @@ index 7d11a02c7..d9a8c4d76 100644 diff --git a/cloudinit/net/network_manager.py b/cloudinit/net/network_manager.py deleted file mode 100644 -index 53763d15e..000000000 +index 53763d15..00000000 --- a/cloudinit/net/network_manager.py +++ /dev/null @@ -1,393 +0,0 @@ @@ -519,7 +519,7 @@ index 53763d15e..000000000 - -# vi: ts=4 expandtab diff --git a/cloudinit/net/renderers.py b/cloudinit/net/renderers.py -index b241683f9..c92b9dcf9 100644 +index b241683f..c92b9dcf 100644 --- a/cloudinit/net/renderers.py +++ b/cloudinit/net/renderers.py @@ -8,7 +8,6 @@ from cloudinit.net import ( @@ -539,7 +539,7 @@ index b241683f9..c92b9dcf9 100644 "openbsd": openbsd, "sysconfig": sysconfig, diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py -index 4262cd489..765c248ae 100644 +index 4262cd48..765c248a 100644 --- a/cloudinit/net/sysconfig.py +++ b/cloudinit/net/sysconfig.py @@ -6,6 +6,8 @@ import os @@ -626,7 +626,7 @@ index 4262cd489..765c248ae 100644 + # vi: ts=4 expandtab diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py -index 0f523ff84..4434b350b 100644 +index 0f523ff8..4434b350 100644 --- a/tests/unittests/test_net.py +++ b/tests/unittests/test_net.py @@ -23,7 +23,6 @@ from cloudinit.net import ( @@ -1349,7 +1349,7 @@ index 0f523ff84..4434b350b 100644 def test_sysconfig_available_uses_variant_mapping(self, m_info, m_avail): m_avail.return_value = True diff --git a/tests/unittests/test_net_activators.py b/tests/unittests/test_net_activators.py -index afd9056af..b735ea9ed 100644 +index afd9056a..b735ea9e 100644 --- a/tests/unittests/test_net_activators.py +++ b/tests/unittests/test_net_activators.py @@ -139,6 +139,10 @@ NETPLAN_AVAILABLE_CALLS = [ diff --git a/0007-rhel-make-sure-previous-hostname-file-ends-with-a-ne.patch b/0007-rhel-make-sure-previous-hostname-file-ends-with-a-ne.patch new file mode 100644 index 0000000..44cd470 --- /dev/null +++ b/0007-rhel-make-sure-previous-hostname-file-ends-with-a-ne.patch @@ -0,0 +1,57 @@ +From ac0cf308318d423162ce3b7be32dcbf88f20ff50 Mon Sep 17 00:00:00 2001 +From: Ani Sinha +Date: Tue, 4 Apr 2023 19:59:07 +0530 +Subject: [PATCH 7/7] rhel: make sure previous-hostname file ends with a new + line (#2108) + +cloud-init strips new line from "/etc/hostname" on rhel distro when processing +"/var/lib/cloud/data/previous-hostname". Although this does not pose a serious +issue, it is still better if the behavior is similar to other distros like +Ubuntu where /previous-hostname does end with a new line. Fix this issue by +using hostname parser in rhel similar to debian. + +Signed-off-by: Ani Sinha +(cherry picked from commit 6d42aa8e2c1a5454a658ab4e2b9cead2677c77cd) +--- + cloudinit/distros/rhel.py | 5 ++++- + tools/.github-cla-signers | 1 + + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/cloudinit/distros/rhel.py b/cloudinit/distros/rhel.py +index df7dc3d6..9625709e 100644 +--- a/cloudinit/distros/rhel.py ++++ b/cloudinit/distros/rhel.py +@@ -13,6 +13,7 @@ from cloudinit import distros, helpers + from cloudinit import log as logging + from cloudinit import subp, util + from cloudinit.distros import rhel_util ++from cloudinit.distros.parsers.hostname import HostnameConf + from cloudinit.settings import PER_INSTANCE + + LOG = logging.getLogger(__name__) +@@ -111,7 +112,9 @@ class Distro(distros.Distro): + # systemd will never update previous-hostname for us, so + # we need to do it ourselves + if self.uses_systemd() and filename.endswith("/previous-hostname"): +- util.write_file(filename, hostname) ++ conf = HostnameConf("") ++ conf.set_hostname(hostname) ++ util.write_file(filename, str(conf), 0o644) + elif self.uses_systemd(): + subp.subp(["hostnamectl", "set-hostname", str(hostname)]) + else: +diff --git a/tools/.github-cla-signers b/tools/.github-cla-signers +index d8cca015..457dacf4 100644 +--- a/tools/.github-cla-signers ++++ b/tools/.github-cla-signers +@@ -9,6 +9,7 @@ andgein + andrew-lee-metaswitch + andrewbogott + andrewlukoshko ++ani-sinha + antonyc + aswinrajamannar + beantaxi +-- +2.39.2 + diff --git a/cloud-init.spec b/cloud-init.spec index 99ae452..79cd67b 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -1,6 +1,6 @@ Name: cloud-init Version: 23.1.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Cloud instance init scripts License: ASL 2.0 or GPLv3 URL: http://launchpad.net/cloud-init @@ -14,6 +14,7 @@ Patch3: 0003-Setting-highest-autoconnect-priority-for-network-scr.patch Patch4: 0004-limit-permissions-on-def_log_file.patch Patch5: 0005-Manual-revert-Use-Network-Manager-and-Netplan-as-def.patch Patch6: 0006-Revert-Add-native-NetworkManager-support-1224.patch +Patch7: 0007-rhel-make-sure-previous-hostname-file-ends-with-a-ne.patch BuildArch: noarch @@ -203,6 +204,10 @@ fi %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %changelog +* Tue Apr 18 2023 Camilla Conte - 23.1.1-2 +- 0007-rhel-make-sure-previous-hostname-file-ends-with-a-ne.patch [bz#2184608] +- Resolves: bz#2184608 + * Thu Mar 30 2023 Camilla Conte - 23.1.1-1 - Rebase to 23.1.1 [bz#2172811] - Resolves: bz#2172811