diff --git a/SOURCES/ci-fix-python3.13-Fix-import-error-for-passlib-on-Pytho.patch b/SOURCES/ci-fix-python3.13-Fix-import-error-for-passlib-on-Pytho.patch new file mode 100644 index 0000000..c47ac46 --- /dev/null +++ b/SOURCES/ci-fix-python3.13-Fix-import-error-for-passlib-on-Pytho.patch @@ -0,0 +1,35 @@ +From 6fc0b92ef5dac36e9def584ba90c1ed813f21752 Mon Sep 17 00:00:00 2001 +From: Brett Holman +Date: Tue, 5 Dec 2023 16:40:03 -0700 +Subject: [PATCH 2/2] fix(python3.13): Fix import error for passlib on Python + 3.13 (#4669) + +RH-Author: Ani Sinha +RH-MergeRequest: 155: fix(rh_subscription): add string type to org (#5453) +RH-Jira: RHEL-81169 +RH-Acked-by: xiachen +RH-Acked-by: Emanuele Giuseppe Esposito +RH-Commit: [2/2] 1742cf86b1a123053c5ced03d764b5deb76f93c8 + +(cherry picked from commit 09b70436b3a0aae1fe24fdde6e8cdd7ee98d9c15) +Signed-off-by: Ani Sinha +--- + cloudinit/sources/DataSourceAzure.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py +index 11c14e20..4c5780f7 100644 +--- a/cloudinit/sources/DataSourceAzure.py ++++ b/cloudinit/sources/DataSourceAzure.py +@@ -58,7 +58,7 @@ try: + ) + except (ImportError, AttributeError): + try: +- import passlib ++ import passlib.hash + + blowfish_hash = passlib.hash.sha512_crypt.hash + except ImportError: +-- +2.48.1 + diff --git a/SOURCES/ci-fix-rh_subscription-add-string-type-to-org-5453.patch b/SOURCES/ci-fix-rh_subscription-add-string-type-to-org-5453.patch new file mode 100644 index 0000000..87e6508 --- /dev/null +++ b/SOURCES/ci-fix-rh_subscription-add-string-type-to-org-5453.patch @@ -0,0 +1,130 @@ +From a31707413ea4b6d425c130e2872f7416b73de766 Mon Sep 17 00:00:00 2001 +From: Alberto Contreras +Date: Mon, 1 Jul 2024 21:04:21 +0200 +Subject: [PATCH 1/2] fix(rh_subscription): add string type to org (#5453) + +RH-Author: Ani Sinha +RH-MergeRequest: 155: fix(rh_subscription): add string type to org (#5453) +RH-Jira: RHEL-81169 +RH-Acked-by: xiachen +RH-Acked-by: Emanuele Giuseppe Esposito +RH-Commit: [1/2] 48d486eebf66e3f32854223bd7db6bf3c6a5d512 + +Per [1], org's correct type is string. Added as new type and deprecated +integer. + +References: +[1] https://github.com/candlepin/subscription-manager/blob/b6fad11e7783ae414fe88fdecee57d8db5c8e292/man/subscription-manager.8#L589 + +Fixes GH-5382 + +One conflict fixed: doc/module-docs/cc_rh_subscription/example2.yaml +is absent in 23.4 since it was added as a part of +f9352b9467626d ("chore(doc): migrate cc modules i through r to templates (#5313)") +later. + +Co-authored-by: pneigel-ca +(cherry picked from commit 681b7de1a598bc5ab1b7d9868dcf2f32fd45aba3) +Signed-off-by: Ani Sinha +--- + cloudinit/config/cc_rh_subscription.py | 4 ++-- + .../config/schemas/schema-cloud-config-v1.json | 14 ++++++++++++-- + .../unittests/config/test_cc_rh_subscription.py | 16 +++++++++++++++- + tools/.github-cla-signers | 1 + + 4 files changed, 30 insertions(+), 5 deletions(-) + +diff --git a/cloudinit/config/cc_rh_subscription.py b/cloudinit/config/cc_rh_subscription.py +index 83fa4f61..b2588915 100644 +--- a/cloudinit/config/cc_rh_subscription.py ++++ b/cloudinit/config/cc_rh_subscription.py +@@ -47,14 +47,14 @@ meta: MetaSchema = { + """\ + rh_subscription: + activation-key: foobar +- org: 12345 ++ org: "ABC" + """ + ), + dedent( + """\ + rh_subscription: + activation-key: foobar +- org: 12345 ++ org: "ABC" + auto-attach: true + service-level: self-support + add-pool: +diff --git a/cloudinit/config/schemas/schema-cloud-config-v1.json b/cloudinit/config/schemas/schema-cloud-config-v1.json +index a553c52c..282d746b 100644 +--- a/cloudinit/config/schemas/schema-cloud-config-v1.json ++++ b/cloudinit/config/schemas/schema-cloud-config-v1.json +@@ -2372,8 +2372,18 @@ + "description": "The activation key to use. Must be used with ``org``. Should not be used with ``username`` or ``password``" + }, + "org": { +- "type": "integer", +- "description": "The organization number to use. Must be used with ``activation-key``. Should not be used with ``username`` or ``password``" ++ "description": "The organization to use. Must be used with ``activation-key``. Should not be used with ``username`` or ``password``", ++ "oneOf": [ ++ { ++ "type": "string" ++ }, ++ { ++ "type": "integer", ++ "deprecated": true, ++ "deprecated_version": "24.2", ++ "deprecated_description": "Use of type integer for this value is deprecated. Use a string instead." ++ } ++ ] + }, + "auto-attach": { + "type": "boolean", +diff --git a/tests/unittests/config/test_cc_rh_subscription.py b/tests/unittests/config/test_cc_rh_subscription.py +index 955b092b..d811d16a 100644 +--- a/tests/unittests/config/test_cc_rh_subscription.py ++++ b/tests/unittests/config/test_cc_rh_subscription.py +@@ -184,7 +184,7 @@ class TestBadInput(CiTestCase): + "rh_subscription": { + "activation-key": "abcdef1234", + "fookey": "bar", +- "org": "123", ++ "org": "ABC", + } + } + +@@ -330,6 +330,20 @@ class TestRhSubscriptionSchema: + {"rh_subscription": {"disable-repo": "name"}}, + "'name' is not of type 'array'", + ), ++ ( ++ { ++ "rh_subscription": { ++ "activation-key": "foobar", ++ "org": "ABC", ++ } ++ }, ++ None, ++ ), ++ ( ++ {"rh_subscription": {"activation-key": "foobar", "org": 314}}, ++ "Deprecated in version 24.2. Use of type integer for this" ++ " value is deprecated. Use a string instead.", ++ ), + ], + ) + @skipUnlessJsonSchema() +diff --git a/tools/.github-cla-signers b/tools/.github-cla-signers +index f4da0989..49f3b130 100644 +--- a/tools/.github-cla-signers ++++ b/tools/.github-cla-signers +@@ -124,6 +124,7 @@ Oursin + outscale-mdr + phsm + phunyguy ++pneigel-ca + qubidt + r00ta + RedKrieg +-- +2.48.1 + diff --git a/SOURCES/ci-rhel-cloud.cfg-remove-ssh_genkeytypes-in-settings.py.patch b/SOURCES/ci-rhel-cloud.cfg-remove-ssh_genkeytypes-in-settings.py.patch deleted file mode 100644 index b0387f2..0000000 --- a/SOURCES/ci-rhel-cloud.cfg-remove-ssh_genkeytypes-in-settings.py.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 5d6674508c6478fa2ca3d8c5d39b533a0bbb317a Mon Sep 17 00:00:00 2001 -From: Emanuele Giuseppe Esposito -Date: Thu, 20 May 2021 08:53:55 +0200 -Subject: [PATCH] rhel/cloud.cfg: remove ssh_genkeytypes in settings.py and set - in cloud.cfg - -RH-Author: Ani Sinha -RH-MergeRequest: 113: rhel/cloud.cfg: remove ssh_genkeytypes in settings.py and set in cloud.cfg -RH-Jira: RHEL-16572 -RH-Acked-by: Vitaly Kuznetsov -RH-Acked-by: Emanuele Giuseppe Esposito -RH-Commit: [1/1] f506bf58dc5458f50624342ec33bcd390aa0b719 (anisinha/rhel-cloud-init) - -RH-Author: Emanuele Giuseppe Esposito -RH-MergeRequest: 10: rhel/cloud.cfg: remove ssh_genkeytypes in settings.py and set in cloud.cfg -RH-Commit: [1/1] 6da989423b9b6e017afbac2f1af3649b0487310f -RH-Bugzilla: 1957532 -RH-Acked-by: Eduardo Otubo -RH-Acked-by: Cathy Avery -RH-Acked-by: Vitaly Kuznetsov -RH-Acked-by: Mohamed Gamal Morsy - -Currently genkeytypes in cloud.cfg is set to None, so together with -ssh_deletekeys=1 cloudinit on first boot it will just delete the existing -keys and not generate new ones. - -Just removing that property in cloud.cfg is not enough, because -settings.py provides another empty default value that will be used -instead, resulting to no key generated even when the property is not defined. - -Removing genkeytypes also in settings.py will default to GENERATE_KEY_NAMES, -but since we want only 'rsa', 'ecdsa' and 'ed25519', add back genkeytypes in -cloud.cfg with the above defaults. - -Also remove ssh_deletekeys in settings.py as we always need -to 1 (and it also defaults to 1). - -Signed-off-by: Emanuele Giuseppe Esposito -(cherry picked from commit b545a0cbabe8924d048b7172b30e7aad59ed32d5) -(cherry picked from commit 855dec5dcc0892c0f7cedf06b025a794769a2a8d) ---- - cloudinit/settings.py | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/cloudinit/settings.py b/cloudinit/settings.py -index a36c518d..859ad546 100644 ---- a/cloudinit/settings.py -+++ b/cloudinit/settings.py -@@ -55,8 +55,6 @@ CFG_BUILTIN = { - "log_cfgs": [], - "syslog_fix_perms": [], - "mount_default_fields": [None, None, "auto", "defaults,nofail", "0", "2"], -- "ssh_deletekeys": False, -- "ssh_genkeytypes": [], - "system_info": { - "paths": { - "cloud_dir": "/var/lib/cloud", --- -2.41.0 - diff --git a/SOURCES/net-nm-check-for-presence-of-ifcfg.patch b/SOURCES/net-nm-check-for-presence-of-ifcfg.patch deleted file mode 100644 index 1f3cbbc..0000000 --- a/SOURCES/net-nm-check-for-presence-of-ifcfg.patch +++ /dev/null @@ -1,112 +0,0 @@ -From d1d5166895da471cff3606c70d4e8ab6eec1c006 Mon Sep 17 00:00:00 2001 -From: Ani Sinha -Date: Thu, 7 Dec 2023 02:39:51 +0530 -Subject: [PATCH] net/nm: check for presence of ifcfg files when nm connection - files are absent (#4645) - -On systems that use network manager to manage connections and activate network -interfaces, they may also use ifcfg files for configuring -interfaces using ifcfg-rh network manager plugin. When network manager is used -as the activator, we need to also check for the presence of ifcfg interface -config file when the network manager connection file is absent and if ifcfg-rh -plugin is present. -Hence, with this change, network manager activator first tries to use network -manager connection files to bring up or bring down the interface. If the -connection files are not present and if ifcfg-rh plugin is present, it tries to -use ifcfg files for the interface. If the plugin or the ifcfg files are not -present, the activator fails to activate or deactivate the interface and it -bails out with warning log. - -Fixes: GH-4640 - -Signed-off-by: Ani Sinha ---- - cloudinit/net/activators.py | 7 +++++++ - cloudinit/net/network_manager.py | 33 ++++++++++++++++++++++++++++++-- - 2 files changed, 38 insertions(+), 2 deletions(-) - -diff --git a/cloudinit/net/activators.py b/cloudinit/net/activators.py -index e69da40d371..dd85886212c 100644 ---- a/cloudinit/net/activators.py -+++ b/cloudinit/net/activators.py -@@ -135,6 +135,13 @@ class NetworkManagerActivator(NetworkActivator): - from cloudinit.net.network_manager import conn_filename - - filename = conn_filename(device_name) -+ if filename is None: -+ LOG.warning( -+ "Unable to find an interface config file. " -+ "Unable to bring up interface." -+ ) -+ return False -+ - cmd = ["nmcli", "connection", "load", filename] - if _alter_interface(cmd, device_name): - cmd = ["nmcli", "connection", "up", "filename", filename] -diff --git a/cloudinit/net/network_manager.py b/cloudinit/net/network_manager.py -index 8a99eb3a1c5..76a0ac15eaa 100644 ---- a/cloudinit/net/network_manager.py -+++ b/cloudinit/net/network_manager.py -@@ -17,10 +17,12 @@ from cloudinit import log as logging - from cloudinit import subp, util - from cloudinit.net import is_ipv6_address, renderer, subnet_is_ipv6 - from cloudinit.net.network_state import NetworkState -+from cloudinit.net.sysconfig import available_nm_ifcfg_rh - - NM_RUN_DIR = "/etc/NetworkManager" - NM_LIB_DIR = "/usr/lib/NetworkManager" - NM_CFG_FILE = "/etc/NetworkManager/NetworkManager.conf" -+IFCFG_CFG_FILE = "/etc/sysconfig/network-scripts" - NM_IPV6_ADDR_GEN_CONF = """# This is generated by cloud-init. Do not edit. - # - [.config] -@@ -374,7 +376,7 @@ class Renderer(renderer.Renderer): - for con_id, conn in self.connections.items(): - if not conn.valid(): - continue -- name = conn_filename(con_id, target) -+ name = nm_conn_filename(con_id, target) - util.write_file(name, conn.dump(), 0o600) - - # Select EUI64 to be used by default by NM for creating the address -@@ -384,12 +386,39 @@ class Renderer(renderer.Renderer): - ) - - --def conn_filename(con_id, target=None): -+def nm_conn_filename(con_id, target=None): - target_con_dir = subp.target_path(target, NM_RUN_DIR) - con_file = f"cloud-init-{con_id}.nmconnection" - return f"{target_con_dir}/system-connections/{con_file}" - - -+def sysconfig_conn_filename(devname, target=None): -+ target_con_dir = subp.target_path(target, IFCFG_CFG_FILE) -+ con_file = f"ifcfg-{devname}" -+ return f"{target_con_dir}/{con_file}" -+ -+ -+def conn_filename(devname): -+ """ -+ This function returns the name of the interface config file. -+ It first checks for presence of network manager connection file. -+ If absent and ifcfg-rh plugin for network manager is available, -+ it returns the name of the ifcfg file if it is present. If the -+ plugin is not present or the plugin is present but ifcfg file is -+ not, it returns None. -+ This function is called from NetworkManagerActivator class in -+ activators.py. -+ """ -+ conn_file = nm_conn_filename(devname) -+ # If the network manager connection file is absent, also check for -+ # presence of ifcfg files for the same interface (if nm-ifcfg-rh plugin is -+ # present, network manager can handle ifcfg files). If both network manager -+ # connection file and ifcfg files are absent, return None. -+ if not os.path.isfile(conn_file) and available_nm_ifcfg_rh(): -+ conn_file = sysconfig_conn_filename(devname) -+ return conn_file if os.path.isfile(conn_file) else None -+ -+ - def cloud_init_nm_conf_filename(target=None): - target_con_dir = subp.target_path(target, NM_RUN_DIR) - conf_file = "30-cloud-init-ip6-addr-gen-mode.conf" diff --git a/SOURCES/tests-unittests-add-a-new-unit-test.patch b/SOURCES/tests-unittests-add-a-new-unit-test.patch deleted file mode 100644 index 105b957..0000000 --- a/SOURCES/tests-unittests-add-a-new-unit-test.patch +++ /dev/null @@ -1,129 +0,0 @@ -From bb474df78bfe45ea5f05907eb710e8d5de764fc8 Mon Sep 17 00:00:00 2001 -From: Ani Sinha -Date: Thu, 7 Dec 2023 21:03:13 +0530 -Subject: [PATCH] tests/unittests: add a new unit test for network manager net - activator (#4672) - -Some changes in behavior in network manager net activator was brought in with -the commit -d1d5166895da ("net/nm: check for presence of ifcfg files when nm connection files are absent") - -This change adds some unit tests that exercizes network manager activator's -bring_up_interface() method that tests failure scenarios as well as cases -where an ifcfg file is used to bring the interface up. - -Signed-off-by: Ani Sinha ---- - tests/unittests/test_net_activators.py | 103 +++++++++++++++++++++++++ - 1 file changed, 103 insertions(+) - -diff --git a/tests/unittests/test_net_activators.py b/tests/unittests/test_net_activators.py -index 2a363ec415b..d53701efafb 100644 ---- a/tests/unittests/test_net_activators.py -+++ b/tests/unittests/test_net_activators.py -@@ -347,3 +347,105 @@ class TestActivatorsBringDown: - activator.bring_down_all_interfaces(network_state) - for call in m_subp.call_args_list: - assert call in expected_call_list -+ -+class TestNetworkManagerActivatorBringUp: -+ @patch("cloudinit.subp.subp", return_value=("", "")) -+ @patch( -+ "cloudinit.net.network_manager.available_nm_ifcfg_rh", -+ return_value=True, -+ ) -+ @patch("os.path.isfile") -+ @patch("os.path.exists", return_value=True) -+ def test_bring_up_interface_no_nm_conn( -+ self, m_exists, m_isfile, m_plugin, m_subp -+ ): -+ """ -+ There is no network manager connection file but ifcfg-rh plugin is -+ present and ifcfg interface config files are also present. In this -+ case, we should use ifcfg files. -+ """ -+ -+ def fake_isfile_no_nmconn(filename): -+ return False if filename.endswith(".nmconnection") else True -+ -+ m_isfile.side_effect = fake_isfile_no_nmconn -+ -+ expected_call_list = [ -+ ( -+ ( -+ [ -+ "nmcli", -+ "connection", -+ "load", -+ "".join( -+ [ -+ "/etc/sysconfig/network-scripts/ifcfg-eth0", -+ ] -+ ), -+ ], -+ ), -+ {}, -+ ), -+ ( -+ ( -+ [ -+ "nmcli", -+ "connection", -+ "up", -+ "filename", -+ "".join( -+ [ -+ "/etc/sysconfig/network-scripts/ifcfg-eth0", -+ ] -+ ), -+ ], -+ ), -+ {}, -+ ), -+ ] -+ -+ index = 0 -+ assert NetworkManagerActivator.bring_up_interface("eth0") -+ for call in m_subp.call_args_list: -+ assert call == expected_call_list[index] -+ index += 1 -+ -+ @patch("cloudinit.subp.subp", return_value=("", "")) -+ @patch( -+ "cloudinit.net.network_manager.available_nm_ifcfg_rh", -+ return_value=False, -+ ) -+ @patch("os.path.isfile") -+ @patch("os.path.exists", return_value=True) -+ def test_bring_up_interface_no_plugin_no_nm_conn( -+ self, m_exists, m_isfile, m_plugin, m_subp -+ ): -+ """ -+ The ifcfg-rh plugin is absent and nmconnection file is also -+ not present. In this case, we can't use ifcfg file and the -+ interface bring up should fail. -+ """ -+ -+ def fake_isfile_no_nmconn(filename): -+ return False if filename.endswith(".nmconnection") else True -+ -+ m_isfile.side_effect = fake_isfile_no_nmconn -+ assert not NetworkManagerActivator.bring_up_interface("eth0") -+ -+ @patch("cloudinit.subp.subp", return_value=("", "")) -+ @patch( -+ "cloudinit.net.network_manager.available_nm_ifcfg_rh", -+ return_value=True, -+ ) -+ @patch("os.path.isfile", return_value=False) -+ @patch("os.path.exists", return_value=True) -+ def test_bring_up_interface_no_conn_file( -+ self, m_exists, m_isfile, m_plugin, m_subp -+ ): -+ """ -+ Neither network manager connection files are present nor -+ ifcfg files are present. Even if ifcfg-rh plugin is present, -+ we can not bring up the interface. So bring_up_interface() -+ should fail. -+ """ -+ assert not NetworkManagerActivator.bring_up_interface("eth0") diff --git a/SPECS/cloud-init.spec b/SPECS/cloud-init.spec index d74e6a1..ae5352d 100644 --- a/SPECS/cloud-init.spec +++ b/SPECS/cloud-init.spec @@ -6,7 +6,7 @@ Name: cloud-init Version: 23.4 -Release: 7%{?dist}.8.alma.2 +Release: 7%{?dist}.9.alma.1 Summary: Cloud instance init scripts Group: System Environment/Base @@ -57,8 +57,12 @@ Patch30: ci-feat-sysconfig-Add-DNS-from-interface-config-to-reso.patch Patch31: ci-fix-Clean-cache-if-no-datasource-fallback-5499.patch # For RHEL-54155 - [RHEL 8.10] cloud-init schema validation fails. Patch32: ci-fix-Add-subnet-ipv4-ipv6-to-network-schema-5191.patch +# For RHEL-81169 - Cloud-init fails to subscribe system if activation key 'org' is not an integer [rhel-8.10.z] +Patch33: ci-fix-rh_subscription-add-string-type-to-org-5453.patch +# For RHEL-81169 - Cloud-init fails to subscribe system if activation key 'org' is not an integer [rhel-8.10.z] +Patch34: ci-fix-python3.13-Fix-import-error-for-passlib-on-Pytho.patch -# AlmaLinux OS patches +# AlmaLinux Patch Patch100: 0001-Improvements-for-AlmaLinux-OS-and-CloudLinux-OS.patch BuildArch: noarch @@ -275,12 +279,15 @@ fi %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %changelog -* Thu Mar 13 2025 Elkhan Mammadli - 23.4-7.el8_10.8.alma.2 -- Update AlmaLinux patch to fix issue with disabling cloud-init service [albz#500] - -* Tue Sep 24 2024 Eduard Abdullin - 23.4-7.el8_10.8.alma.1 +* Tue Apr 22 2025 Eduard Abdullin - 23.4-7.9.alma.1 - 0001-Improvements-for-AlmaLinux-OS-and-CloudLinux-OS.patch +* Mon Mar 10 2025 Jon Maloy - 23.4-7.el8.9 +- ci-fix-rh_subscription-add-string-type-to-org-5453.patch [RHEL-81169] +- ci-fix-python3.13-Fix-import-error-for-passlib-on-Pytho.patch [RHEL-81169] +- Resolves: RHEL-81169 + (Cloud-init fails to subscribe system if activation key 'org' is not an integer [rhel-8.10.z]) + * Tue Aug 20 2024 Jon Maloy - 23.4-7.el8_10.8 - ci-fix-Add-subnet-ipv4-ipv6-to-network-schema-5191.patch [RHEL-54155] - Resolves: RHEL-54155