diff --git a/SOURCES/0041-enable-ec2_utils-to-stop-retrying-to-get-ec2-metadata.patch b/SOURCES/0041-enable-ec2_utils-to-stop-retrying-to-get-ec2-metadata.patch new file mode 100644 index 0000000..d691b94 --- /dev/null +++ b/SOURCES/0041-enable-ec2_utils-to-stop-retrying-to-get-ec2-metadata.patch @@ -0,0 +1,50 @@ +Enable ec2_utils to stop retrying to get ec2 metadata + +Signed-off-by: David Sloboda +Reviewed-by: Laurence Rochfort + +diff -ruN a/cloudinit/sources/helpers/openstack.py b/cloudinit/sources/helpers/openstack.py +--- a/cloudinit/sources/helpers/openstack.py 2018-04-02 12:51:20.053828637 -0700 ++++ b/cloudinit/sources/helpers/openstack.py 2018-04-02 12:33:20.000000000 -0700 +@@ -464,6 +464,16 @@ + + return results + ++def should_retry_cb(_request_args, cause): ++ try: ++ code = int(cause.code) ++ if code >= 400: ++ return False ++ except (TypeError, ValueError): ++ # Older versions of requests didn't have a code. ++ pass ++ return True ++ + + class MetadataReader(BaseReader): + def __init__(self, base_url, ssl_details=None, timeout=5, retries=5): +@@ -489,16 +499,6 @@ + return self._versions + + def _path_read(self, path, decode=False): +- def should_retry_cb(_request_args, cause): +- try: +- code = int(cause.code) +- if code >= 400: +- return False +- except (TypeError, ValueError): +- # Older versions of requests didn't have a code. +- pass +- return True +- + response = url_helper.readurl( + path, + retries=self.retries, +@@ -519,6 +519,7 @@ + ssl_details=self.ssl_details, + timeout=self.timeout, + retries=self.retries, ++ exception_cb=should_retry_cb, + ) + + diff --git a/SOURCES/0106-tests-unittests-add-a-new-unit-test-for-network-mana.patch b/SOURCES/0106-tests-unittests-add-a-new-unit-test-for-network-mana.patch new file mode 100644 index 0000000..2248cbf --- /dev/null +++ b/SOURCES/0106-tests-unittests-add-a-new-unit-test-for-network-mana.patch @@ -0,0 +1,136 @@ +From 37a6837813e418486af8cbef436ab82a8be3e3fa Mon Sep 17 00:00:00 2001 +From: Darren Archibald +Date: Fri, 23 Feb 2024 06:06:30 -0800 +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 +(cherry picked from commit bb474df78bfe45ea5f05907eb710e8d5de764fc8) +Signed-off-by: Darren Archibald +--- + tests/unittests/test_net_activators.py | 101 +++++++++++++++++++++++++ + 1 file changed, 101 insertions(+) + +diff --git a/tests/unittests/test_net_activators.py b/tests/unittests/test_net_activators.py +index 2a363ec..f95c8a7 100644 +--- a/tests/unittests/test_net_activators.py ++++ b/tests/unittests/test_net_activators.py +@@ -288,6 +288,107 @@ class TestActivatorsBringUp: + 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") + + IF_UP_DOWN_BRING_DOWN_CALL_LIST: list = [ + ((["ifdown", "eth0"],), {}), +-- +2.31.1 + diff --git a/SOURCES/1010-orabug36958039-Removes-condition-specific-to-OL-for-write_files_def.patch b/SOURCES/1010-orabug36958039-Removes-condition-specific-to-OL-for-write_files_def.patch new file mode 100644 index 0000000..f72fbe8 --- /dev/null +++ b/SOURCES/1010-orabug36958039-Removes-condition-specific-to-OL-for-write_files_def.patch @@ -0,0 +1,31 @@ +From 4964e60ede9445e9891cf8501060ac2751a3ba5f Mon Sep 17 00:00:00 2001 +From: Sourav Sharma +Date: Fri, 22 Nov 2024 14:32:05 +0530 +Subject: [PATCH] Removes condition specific to OL for write_files_deferred + +Github-issue-link: https://github.com/oracle/oracle-linux/issues/156 + +Orabug: 36958039 + +Signed-off-by: Sourav Sharma +--- + config/cloud.cfg.tmpl | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl +index c756719..28ee581 100644 +--- a/config/cloud.cfg.tmpl ++++ b/config/cloud.cfg.tmpl +@@ -199,9 +199,7 @@ cloud_final_modules: + {% if variant in ["ubuntu", "unknown"] %} + - ubuntu_drivers + {% endif %} +-{% if variant not in ["ol"] %} + - write_files_deferred +-{% endif %} + - puppet + - chef + - ansible +-- +2.43.5 + 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..e327f13 --- /dev/null +++ b/SOURCES/ci-fix-rh_subscription-add-string-type-to-org-5453.patch @@ -0,0 +1,131 @@ +From 9066bea7bebf583f81f841ae7f8c99728df4982f Mon Sep 17 00:00:00 2001 +From: Alberto Contreras +Date: Mon, 1 Jul 2024 21:04:21 +0200 +Subject: [PATCH] fix(rh_subscription): add string type to org (#5453) + +RH-Author: xiachen +RH-MergeRequest: 158: fix(rh_subscription): add string type to org (#5453) +RH-Jira: RHEL-81163 +RH-Acked-by: Emanuele Giuseppe Esposito +RH-Acked-by: Jon Maloy +RH-Acked-by: Ani Sinha +RH-Commit: [1/1] 0210968f6630cc3a10d8f4f16f274280f00fabb0 + +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: Amy Chen +--- + 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 c5f46f37..6e4fcca9 100644 +--- a/cloudinit/config/schemas/schema-cloud-config-v1.json ++++ b/cloudinit/config/schemas/schema-cloud-config-v1.json +@@ -2451,8 +2451,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 8b119025..fc95f611 100644 +--- a/tools/.github-cla-signers ++++ b/tools/.github-cla-signers +@@ -125,6 +125,7 @@ Oursin + outscale-mdr + phsm + phunyguy ++pneigel-ca + qubidt + r00ta + RedKrieg +-- +2.48.1 + diff --git a/SOURCES/ignore-enslaved-interface.patch b/SOURCES/ignore-enslaved-interface.patch new file mode 100644 index 0000000..cfefbe4 --- /dev/null +++ b/SOURCES/ignore-enslaved-interface.patch @@ -0,0 +1,44 @@ +From e7aba0f0ccd6f023667f41385f25044a94428ed3 Mon Sep 17 00:00:00 2001 +From: Darren Archibald +Date: Fri, 23 Feb 2024 05:56:06 -0800 +Subject: [PATCH] ignore enslaved interface + + Changes to ignore all enslaved interfaces. + https://jira.oci.oraclecorp.com/browse/LINUX-1947 + + Orabug: 30092148 + + Signed-off-by: Si-Wei Liu + Signed-off-by: Darren Archibald +--- + cloudinit/net/__init__.py | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py +index c0888f5..b093796 100644 +--- a/cloudinit/net/__init__.py ++++ b/cloudinit/net/__init__.py +@@ -335,6 +335,10 @@ def is_netfail_standby(devname, driver=None): + return True + + ++def is_slave(devname): ++ return os.path.exists(sys_dev_path(devname, "master")) ++ ++ + def is_renamed(devname): + """ + /* interface name assignment types (sysfs name_assign_type attribute) */ +@@ -1054,6 +1058,9 @@ def get_interfaces( + if is_bridge(name): + filtered_logger("Ignoring bridge interface: %s", name) + continue ++ if is_slave(name): ++ filtered_logger("Ignoring bridge interface: %s", name) ++ continue + if filter_vlan and is_vlan(name): + continue + if is_bond(name): +-- +2.31.1 + diff --git a/SOURCES/ol-sysconfig-add-Oracle-Linux-variant-to-known-distros.patch b/SOURCES/ol-sysconfig-add-Oracle-Linux-variant-to-known-distros.patch new file mode 100644 index 0000000..c8b89d8 --- /dev/null +++ b/SOURCES/ol-sysconfig-add-Oracle-Linux-variant-to-known-distros.patch @@ -0,0 +1,26 @@ +From 8735577c8a683407e94abed0cfccc3aacbb9aa47 Mon Sep 17 00:00:00 2001 +From: Si-Wei Liu +Date: Wed, 10 Jun 2020 20:59:29 -0400 +Subject: [PATCH] sysconfig: add Oracle Linux variant to known distros + +otherwise anything sysconfig breaks on Oracle Linux. + +JIRA: https://jira.oci.oraclecorp.com/browse/LINUX-6128 + +Signed-off-by: Si-Wei Liu +--- + cloudinit/net/sysconfig.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py +index e94590f..55b7db5 100644 +--- a/cloudinit/net/sysconfig.py ++++ b/cloudinit/net/sysconfig.py +@@ -35,6 +35,7 @@ + "suse", + "TencentOS", + "virtuozzo", ++ "ol", + ] + + diff --git a/SOURCES/orabug29956753-DataSourceOracle-_is_iscsi_root-not-working-with-dra.patch b/SOURCES/orabug29956753-DataSourceOracle-_is_iscsi_root-not-working-with-dra.patch new file mode 100644 index 0000000..4443391 --- /dev/null +++ b/SOURCES/orabug29956753-DataSourceOracle-_is_iscsi_root-not-working-with-dra.patch @@ -0,0 +1,81 @@ +From 8eff3fdfd9ed477bead953deec3599c93409a415 Mon Sep 17 00:00:00 2001 +From: Darren Archibald +Date: Fri, 23 Feb 2024 05:33:05 -0800 +Subject: [PATCH] DataSourceOracle: _is_iscsi_root() not working with dracut + based initramfs + +The _is_iscsi_root() implementation in Oracle datasource today only works +with initramfs-tools on Debian/Ubuntu systems, where initramfs-tools specific +files e.g. /run/net{,6}-*.conf are examined to identify initramfs initiated +network configuration. This partial implementation works with OCI Oracle +Linux (OL) images by chance as the "network-config=..." option in the boot +line happens to satisfy the corresponding network-config conditional +branch (which itself is insufficient in checking disabled network-config) in +cmdline.read_kernel_cmdline_config, and eventually renders _is_iscsi_root() +return true for OL images all across. Apparently this shouldn't be the +case for VM instance with PV boot. + +The fix involved is to identify dracut based initramfs config files for +network boot, and also ibft as how it does for initramfs-tools based +initramfs on Ubuntu. + +Orabug: 29956753 + +Signed-off-by: Si-Wei Liu +Signed-off-by: Darren Archibald +--- + cloudinit/sources/DataSourceOracle.py | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +diff --git a/cloudinit/sources/DataSourceOracle.py b/cloudinit/sources/DataSourceOracle.py +index 07247d7..afae393 100644 +--- a/cloudinit/sources/DataSourceOracle.py ++++ b/cloudinit/sources/DataSourceOracle.py +@@ -14,6 +14,8 @@ Notes: + """ + + import base64 ++import glob ++import os + import ipaddress + import logging + from collections import namedtuple +@@ -31,6 +33,11 @@ from cloudinit.url_helper import UrlError, readurl + + LOG = logging.getLogger(__name__) + ++DRACUT_TMP_PATH='/var/run/initramfs' ++DRACUT_OLDTMP_PATH='/dev/.initramfs' ++DRACUT_NET_IFACES='net.ifaces' ++DRACUT_IBFT_PATTERN='net.*.has_ibft_config' ++ + BUILTIN_DS_CONFIG = { + # Don't use IMDS to configure secondary NICs by default + "configure_secondary_nics": False, +@@ -200,9 +207,22 @@ class DataSourceOracle(sources.DataSource): + def get_public_ssh_keys(self): + return sources.normalize_pubkey_data(self.metadata.get("public_keys")) + ++ def _is_dracut_netconfig(): ++ for net_ifaces_path in ( ++ DRACUT_TMP_PATH + '/' + DRACUT_NET_IFACES, ++ DRACUT_OLDTMP_PATH + '/' + DRACUT_NET_IFACES): ++ if os.path.exists(net_ifaces_path): ++ return True ++ ++ if glob.glob(DRACUT_TMP_PATH + '/' + DRACUT_IBFT_PATTERN) + \ ++ glob.glob(DRACUT_OLDTMP_PATH + '/' + DRACUT_IBFT_PATTERN): ++ return True ++ ++ return False ++ + def _is_iscsi_root(self) -> bool: + """Return whether we are on a iscsi machine.""" +- return self._network_config_source.is_applicable() ++ return self._network_config_source.is_applicable() or _is_dracut_netconfig() + + def _get_iscsi_config(self) -> dict: + return self._network_config_source.render_config() +-- +2.31.1 + diff --git a/SOURCES/orabug30435672-003-cloud-init-collect-logs.patch b/SOURCES/orabug30435672-003-cloud-init-collect-logs.patch new file mode 100644 index 0000000..1ba0aad --- /dev/null +++ b/SOURCES/orabug30435672-003-cloud-init-collect-logs.patch @@ -0,0 +1,78 @@ +From 51cdd87ad861d5d47c212258bf00402a4dec2198 Mon Sep 17 00:00:00 2001 +From: Darren Archibald +Date: Fri, 23 Feb 2024 06:17:54 -0800 +Subject: [PATCH] Update cloud-init collect-logs for Oracle Linux + +Updating the code to collect triage logs with OL distro specic methods. + +Orabug: 30435672 + +Signed-off-by: Vijay Balakrishna +Reviewed-by: Si-Wei Liu +Acked-by: Joe Kennedy +Reviewed-by: Laurence Rochfort +--- + cloudinit/cmd/devel/logs.py | 26 ++++++++++++++++---------- + cloudinit/util.py | 1 + + 2 files changed, 17 insertions(+), 10 deletions(-) + +diff --git a/cloudinit/cmd/devel/logs.py b/cloudinit/cmd/devel/logs.py +index 8312218..85d976a 100755 +--- a/cloudinit/cmd/devel/logs.py ++++ b/cloudinit/cmd/devel/logs.py +@@ -19,7 +19,7 @@ from cloudinit.cmd.devel import read_cfg_paths + from cloudinit.helpers import Paths + from cloudinit.subp import ProcessExecutionError, subp + from cloudinit.temp_utils import tempdir +-from cloudinit.util import chdir, copy, ensure_dir, write_file ++from cloudinit.util import chdir, copy, ensure_dir, write_file, system_info + + CLOUDINIT_LOGS = ["/var/log/cloud-init.log", "/var/log/cloud-init-output.log"] + CLOUDINIT_RUN_DIR = "/run/cloud-init" +@@ -219,15 +219,21 @@ def collect_logs(tarfile, include_userdata: bool, verbosity=0): + msg="cloud-init --version", + verbosity=verbosity, + ) +- dpkg_ver = _write_command_output_to_file( +- cmd=["dpkg-query", "--show", "-f=${Version}\n", "cloud-init"], +- filename=os.path.join(log_dir, "dpkg-version"), +- msg="dpkg version", +- verbosity=verbosity, +- ) +- if not version: +- version = dpkg_ver if dpkg_ver else "not-available" +- print("version: ", version) ++ if system_info()['variant'] == "ol": ++ rpm_ver = _write_command_output_to_file( ++ ['rpm', '-q', '--queryformat', ++ "[%{VERSION}-%{RELEASE}.%{ARCH}]\n", 'cloud-init'], ++ os.path.join(log_dir, 'rpm-version'), ++ "rpm version", verbosity) ++ if not version: ++ version = rpm_ver if rpm_ver else "not-available" ++ else: ++ dpkg_ver = _write_command_output_to_file( ++ ['dpkg-query', '--show', "-f=${Version}\n", 'cloud-init'], ++ os.path.join(log_dir, 'dpkg-version'), ++ "dpkg version", verbosity) ++ if not version: ++ version = dpkg_ver if dpkg_ver else "not-available" + _debug("collected cloud-init version: %s\n" % version, 1, verbosity) + _stream_command_output_to_file( + cmd=["dmesg"], +diff --git a/cloudinit/util.py b/cloudinit/util.py +index 3295735..db7bb97 100644 +--- a/cloudinit/util.py ++++ b/cloudinit/util.py +@@ -660,6 +660,7 @@ def _get_variant(info): + "suse", + "tencentos", + "virtuozzo", ++ "ol", + ): + variant = linux_dist + elif linux_dist in ("ubuntu", "linuxmint", "mint"): +-- +2.31.1 + diff --git a/SOURCES/orabug30435672-004-ol-cloud-config.patch b/SOURCES/orabug30435672-004-ol-cloud-config.patch new file mode 100644 index 0000000..5958b77 --- /dev/null +++ b/SOURCES/orabug30435672-004-ol-cloud-config.patch @@ -0,0 +1,112 @@ +From 250aa45f74e29b95f81b24811c972369605bd24e Mon Sep 17 00:00:00 2001 +From: Vijay Balakrishna +Date: Tue, 5 Nov 2019 16:00:21 -0500 +Subject: [PATCH] Add static cloud.cfg file for OL7. + +Adding OL specific cloud.cfg file to enable updates cloud-init +config file independently, adding newly verified ntp module. + +Orabug: 30435672 + +Signed-off-by: Vijay Balakrishna +Signed-off-by: Si-Wei Liu +Acked-by: Joe Kennedy +Reviewed-by: Laurence Rochfort + +--- + ol/README.ol | 6 ++++++ + ol/cloud.cfg | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 75 insertions(+) + create mode 100644 ol/README.ol + create mode 100644 ol/cloud.cfg + +diff --git a/ol/README.ol b/ol/README.ol +new file mode 100644 +index 0000000..f59d559 +--- /dev/null ++++ b/ol/README.ol +@@ -0,0 +1,6 @@ ++The following cloud-init modules are currently unsupported on this OS: ++ - apt_update_upgrade ('apt_update', 'apt_upgrade', 'apt_mirror', 'apt_preserve_sources_list', 'apt_old_mirror', 'apt_sources', 'debconf_selections', 'packages' options) ++ - byobu ('byobu_by_default' option) ++ - chef ++ - grub_dpkg ++ - rh_subscription +diff --git a/ol/cloud.cfg b/ol/cloud.cfg +new file mode 100644 +index 0000000..2ee1fb3 +--- /dev/null ++++ b/ol/cloud.cfg +@@ -0,0 +1,69 @@ ++users: ++ - default ++ ++disable_root: 1 ++ssh_pwauth: 0 ++ ++mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service', '0', '2'] ++resize_rootfs_tmp: /dev ++ssh_deletekeys: 0 ++ssh_genkeytypes: ~ ++syslog_fix_perms: ~ ++disable_vmware_customization: false ++ ++cloud_init_modules: ++ - disk_setup ++ - migrator ++ - bootcmd ++ - write-files ++ - growpart ++ - resizefs ++ - set_hostname ++ - update_hostname ++ - update_etc_hosts ++ - rsyslog ++ - users-groups ++ - ssh ++ ++cloud_config_modules: ++ - mounts ++ - locale ++ - set-passwords ++ - ntp ++ - yum-add-repo ++ - package-update-upgrade-install ++ - timezone ++ - puppet ++ - chef ++ - salt-minion ++ - mcollective ++ - disable-ec2-metadata ++ - runcmd ++ ++cloud_final_modules: ++ - rightscale_userdata ++ - scripts-per-once ++ - scripts-per-boot ++ - scripts-per-instance ++ - scripts-user ++ - ssh-authkey-fingerprints ++ - keys-to-console ++ - phone-home ++ - final-message ++ - power-state-change ++ ++system_info: ++ default_user: ++ name: cloud-user ++ lock_passwd: true ++ gecos: Cloud User ++ groups: [adm, systemd-journal] ++ sudo: ["ALL=(ALL) NOPASSWD:ALL"] ++ shell: /bin/bash ++ distro: rhel ++ paths: ++ cloud_dir: /var/lib/cloud ++ templates_dir: /etc/cloud/templates ++ ssh_svcname: sshd ++ ++# vim:syntax=yaml +-- +1.8.3.1 + diff --git a/SOURCES/orabug30435672-006-cc_spacewalk.py.patch b/SOURCES/orabug30435672-006-cc_spacewalk.py.patch new file mode 100644 index 0000000..1feb434 --- /dev/null +++ b/SOURCES/orabug30435672-006-cc_spacewalk.py.patch @@ -0,0 +1,57 @@ +From 2b92e042bb8a4510abec38fcfc302d8de1e28f37 Mon Sep 17 00:00:00 2001 +From: Darren Archibald +Date: Fri, 23 Feb 2024 06:55:32 -0800 +Subject: [PATCH] spacewalk: fix CA cert file path for Oracle Linux + +Update the CA cert file that is available in Oracle Linux to register with ULN. + +Orabug: 30435672 + +Signed-off-by: Si-Wei Liu +Signed-off-by: Vijay Balakrishna +Acked-by: Joe Kennedy +Reviewed-by: Laurence Rochfort +Signed-off-by: Darren Archibald +--- + cloudinit/config/cc_spacewalk.py | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/cloudinit/config/cc_spacewalk.py b/cloudinit/config/cc_spacewalk.py +index 08514f2..7248cce 100644 +--- a/cloudinit/config/cc_spacewalk.py ++++ b/cloudinit/config/cc_spacewalk.py +@@ -4,7 +4,7 @@ + import logging + from textwrap import dedent + +-from cloudinit import subp ++from cloudinit import subp, util + from cloudinit.cloud import Cloud + from cloudinit.config import Config + from cloudinit.config.schema import MetaSchema, get_meta_doc +@@ -47,6 +47,7 @@ LOG = logging.getLogger(__name__) + distros = ["redhat", "fedora"] + required_packages = ["rhn-setup"] + def_ca_cert_path = "/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT" ++ol_ca_cert_path = "/usr/share/rhn/ULN-CA-CERT" + + + def is_registered(): +@@ -100,9 +101,14 @@ def handle(name: str, cfg: Config, cloud: Cloud, args: list) -> None: + # Need to have this installed before further things will work. + cloud.distro.install_packages(required_packages) + if not is_registered(): ++ if util.system_info()['variant'] == "ol": ++ cert = ol_ca_cert_path ++ else: ++ cert = def_ca_cert_path + do_register( + spacewalk_server, + cloud.datasource.get_hostname(fqdn=True).hostname, ++ ca_cert_path=cert, + proxy=cfg.get("proxy"), + activation_key=cfg.get("activation_key"), + ) +-- +2.31.1 + diff --git a/SOURCES/orabug32183938-009-missing-sshd-services.patch b/SOURCES/orabug32183938-009-missing-sshd-services.patch new file mode 100644 index 0000000..4bacda5 --- /dev/null +++ b/SOURCES/orabug32183938-009-missing-sshd-services.patch @@ -0,0 +1,30 @@ +cloud-init service file is missing sshd required services +Orabug: 32183938 + +in the systemd sshd-keygen.target file, the following services are listed: +[Unit] +Wants=sshd-keygen@rsa.service +Wants=sshd-keygen@ecdsa.service +Wants=sshd-keygen@ed25519.service + +Need to add the following to the cloud-init service file: +Before=sshd-keygen@rsa.service +Before=sshd-keygen@ecdsa.service +Before=sshd-keygen@ed25519.service + +Signed-off-by: Isaac Chen + +diff -up cloud-init-19.4/systemd/cloud-init.service.tmpl.orig cloud-init-19.4/systemd/cloud-init.service.tmpl +--- cloud-init-19.4/systemd/cloud-init.service.tmpl.orig 2020-12-10 13:03:19.978023730 -0800 ++++ cloud-init-19.4/systemd/cloud-init.service.tmpl 2020-12-10 13:07:35.791879370 -0800 +@@ -21,7 +21,9 @@ After=wicked.service + After=dbus.service + {% endif %} + Before=network-online.target +-Before=sshd-keygen.service ++Before=sshd-keygen@rsa.service ++Before=sshd-keygen@ecdsa.service ++Before=sshd-keygen@ed25519.service + Before=sshd.service + {% if variant in ["ubuntu", "unknown", "debian"] %} + Before=sysinit.target diff --git a/SOURCES/orabug32183938-010-missing-sshd-services-in-rhel-systemd.patch b/SOURCES/orabug32183938-010-missing-sshd-services-in-rhel-systemd.patch new file mode 100644 index 0000000..7cb4fb0 --- /dev/null +++ b/SOURCES/orabug32183938-010-missing-sshd-services-in-rhel-systemd.patch @@ -0,0 +1,22 @@ +cloud-init service file is missing sshd required services +Orabug: 32183938 + +This patch is the supplement of patch orabug32183938-009, where changes +to cloud-init.service also need to be added to files in rhel/systemd. + +Signed-off-by: Isaac Chen + +diff -up cloud-init-19.4/systemd/cloud-init.service.tmpl.orig cloud-init-19.4/systemd/cloud-init.service.tmpl +--- cloud-init-19.4/systemd/cloud-init.service.tmpl.orig 2020-12-11 19:59:37.331277979 -0800 ++++ cloud-init-19.4/systemd/cloud-init.service.tmpl 2020-12-11 20:00:38.867459043 -0800 +@@ -5,7 +5,9 @@ + DefaultDependencies=no + {% endif %} + Wants=cloud-init-local.service +-Wants=sshd-keygen.service ++Wants=sshd-keygen@rsa.service ++Wants=sshd-keygen@ecdsa.service ++Wants=sshd-keygen@ed25519.service + Wants=sshd.service + After=cloud-init-local.service + After=systemd-networkd-wait-online.service diff --git a/SOURCES/orabug34845400-Add-Oracle-to-distro-detection-logic-in-cloud.cfg.tm.patch b/SOURCES/orabug34845400-Add-Oracle-to-distro-detection-logic-in-cloud.cfg.tm.patch new file mode 100644 index 0000000..8d56c9b --- /dev/null +++ b/SOURCES/orabug34845400-Add-Oracle-to-distro-detection-logic-in-cloud.cfg.tm.patch @@ -0,0 +1,354 @@ +From e921be03f802ee154ed1ddf044e276b23af0d2b6 Mon Sep 17 00:00:00 2001 +From: Darren Archibald +Date: Fri, 23 Feb 2024 07:52:25 -0800 +Subject: [PATCH] Add Oracle to distro detection logic in cloud.cfg.tmpl + +Oracle Linux is being detected as "ol" variant by cloud-init. +This patch adds "ol" to the list of supported variants, and applies needed settings to it. +You can notice that variant "ol" is being set as distro "rhel" in a couple of places, +that is expected as this designated that base distro for "ol" is "rhel" ( which is true ) + +The main reason for this change is that cloud-init package dropped hardcoded configs that set OL as rhel +and to make cloud-init behave on OL systems as expected we need to add "ol" designation to supported list. + +Orabug: 34845400 +Signed-off-by: Alex Burmashev +Signed-off-by: Darren Archibald +--- + cloudinit/distros/__init__.py | 1 + + cloudinit/sources/DataSourceRbxCloud.py | 2 +- + config/cloud.cfg.tmpl | 33 ++++++++++++++++++------- + systemd/cloud-config.service.tmpl | 4 +++ + systemd/cloud-final.service.tmpl | 4 ++- + systemd/cloud-init-local.service.tmpl | 12 ++++++--- + systemd/cloud-init.service.tmpl | 8 ++++-- + tests/unittests/test_util.py | 1 + + 8 files changed, 48 insertions(+), 17 deletions(-) + +diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py +index 79e2623..8f1381b 100644 +--- a/cloudinit/distros/__init__.py ++++ b/cloudinit/distros/__init__.py +@@ -78,6 +78,7 @@ OSFAMILIES = { + "rhel", + "rocky", + "virtuozzo", ++ "ol", + ], + "suse": [ + "opensuse", +diff --git a/cloudinit/sources/DataSourceRbxCloud.py b/cloudinit/sources/DataSourceRbxCloud.py +index 9214f1b..5379132 100644 +--- a/cloudinit/sources/DataSourceRbxCloud.py ++++ b/cloudinit/sources/DataSourceRbxCloud.py +@@ -60,7 +60,7 @@ def _sub_arp(cmd): + + def gratuitous_arp(items, distro): + source_param = "-S" +- if distro.name in ["fedora", "centos", "rhel"]: ++ if distro.name in ["fedora", "centos", "rhel", "ol"]: + source_param = "-s" + for item in items: + try: +diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl +@@ -39,7 +39,7 @@ + - name: root + lock_passwd: false + {% else %} +- - default ++ - default + {% endif %} + + {% if variant == "photon" %} +@@ -58,9 +58,9 @@ + {% endif %} + + {%- if variant in ["alpine", "amazon", "fedora", "OpenCloudOS", "openeuler", +- "openmandriva", "photon", "TencentOS"] or is_rhel %} ++ "openmandriva", "photon", "TencentOS", "ol"] or is_rhel %} + +-{% if is_rhel %} ++{% if variant in ["ol"] or is_rhel %} + mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service,_netdev', '0', '2'] + {% else %} + mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2'] +@@ -101,7 +101,7 @@ + + {% endif -%} + +-{% if is_rhel %} ++{% if variant in ["ol"] or is_rhel %} + # Default redhat settings: + ssh_deletekeys: true + ssh_genkeytypes: ['rsa', 'ecdsa', 'ed25519'] +@@ -149,9 +149,9 @@ + {% if variant == "ubuntu" %} + - ubuntu_autoinstall + {% endif %} +-{% if variant not in ["photon"] %} ++{% if variant not in ["photon", "ol"] %} + - ssh_import_id +-{% if not is_rhel %} ++{% if variant not in ["ol"] or is_rhel %} + - keyboard + {% endif %} + - locale +@@ -167,18 +167,20 @@ + - ubuntu_advantage + {% endif %} + {% elif variant in ["fedora", "mariner", "openeuler", "openmandriva", +- "photon"] or is_rhel %} ++ "photon", "ol"] or is_rhel %} + {% if is_rhel %} + - rh_subscription + {% endif %} +-{% if variant not in ["mariner", "photon"] %} ++{% if variant not in ["mariner", "photon", "ol"] %} + - spacewalk + {% endif %} + - yum_add_repo + {% elif variant == "suse" %} + - zypper_add_repo + {% endif %} ++{% if variant not in ["ol"] %} + - ntp ++{% endif %} + - timezone + - disable_ec2_metadata + - runcmd +@@ -197,13 +199,17 @@ + {% if variant in ["ubuntu", "unknown"] %} + - ubuntu_drivers + {% endif %} ++{% if variant not in ["ol"] %} + - write_files_deferred ++{% endif %} + - puppet + - chef + - ansible + - mcollective + - salt_minion ++{% if variant not in ["ol"] %} + - reset_rmc ++{% endif %} + - rightscale_userdata + - scripts_vendor + - scripts_per_once +@@ -212,7 +218,9 @@ + - scripts_user + - ssh_authkey_fingerprints + - keys_to_console ++{% if variant not in ["ol"] %} + - install_hotplug ++{% endif %} + - phone_home + - final_message + - power_state_change +@@ -224,8 +232,10 @@ + {% if variant in ["alpine", "amazon", "arch", "debian", "fedora", "freebsd", + "gentoo", "mariner", "netbsd", "openbsd", "OpenCloudOS", + "openeuler", "openmandriva", "photon", "suse", "TencentOS", +- "ubuntu"] or is_rhel %} ++ "ubuntu", "centos", "rhel"] %} + distro: {{ variant }} ++{% elif variant == "ol" %} ++ distro: rhel + {% elif variant == "dragonfly" %} + distro: dragonflybsd + {% else %} +@@ -234,7 +244,9 @@ + {% endif %} + # Default user name + that default users groups (if added/used) + default_user: +-{% if variant in usernames %} ++{% if variant == "ol" %} ++ name: cloud-user ++{% elif variant in usernames %} + name: {{ usernames[variant] }} + {% else %} + name: {{ variant }} +@@ -245,7 +257,12 @@ + or is_bsd or is_rhel %} + lock_passwd: True + {% endif %} +-{% if variant in gecos %} ++{% if variant == "ol" %} ++ lock_passwd: true ++{% endif %} ++{% if variant == "ol" %} ++ gecos: Cloud User ++{% elif variant in gecos %} + gecos: {{ gecos[variant] }} + {% else %} + gecos: {{ variant }} Cloud User +@@ -254,7 +271,7 @@ + groups: [{{ groups[variant] }}] + {% elif is_bsd %} + groups: [wheel] +-{% elif is_rhel %} ++{% elif variant in ["ol"] or is_rhel %} + groups: [adm, systemd-journal] + {% else %} + groups: [wheel, adm, systemd-journal] +@@ -321,7 +338,7 @@ + {% endif %} + {% if variant in ["alpine", "amazon", "arch", "debian", "fedora", "gentoo", + "mariner", "OpenCloudOS", "openeuler", "openmandriva", +- "photon", "suse", "TencentOS", "ubuntu", "unknown"] ++ "photon", "suse", "TencentOS", "ubuntu", "unknown", "ol"] + or is_rhel %} + # Other config here will be given to the distro class and/or path classes + paths: +@@ -365,6 +382,6 @@ + ssh_svcname: ssh + {% elif variant in ["alpine", "amazon", "arch", "fedora", "gentoo", + "mariner", "OpenCloudOS", "openeuler", "openmandriva", +- "photon", "suse", "TencentOS"] or is_rhel %} ++ "photon", "suse", "TencentOS", "ol"] or is_rhel %} + ssh_svcname: sshd + {% endif %} +diff --git a/systemd/cloud-config.service.tmpl b/systemd/cloud-config.service.tmpl +index 31d9d98..8222c7c 100644 +--- a/systemd/cloud-config.service.tmpl ++++ b/systemd/cloud-config.service.tmpl +@@ -2,11 +2,15 @@ + [Unit] + Description=Apply the settings specified in cloud-config + After=network-online.target cloud-config.target ++{% if variant not in "ol" %} + After=snapd.seeded.service ++{% endif %} + Before=systemd-user-sessions.service + Wants=network-online.target cloud-config.target ++{% if variant in ["rhel", "ol"] %} + ConditionPathExists=!/etc/cloud/cloud-init.disabled + ConditionKernelCommandLine=!cloud-init=disabled ++{% endif %} + ConditionEnvironment=!KERNEL_CMDLINE=cloud-init=disabled + + [Service] +diff --git a/systemd/cloud-final.service.tmpl b/systemd/cloud-final.service.tmpl +index bcf8b00..f84c687 100644 +--- a/systemd/cloud-final.service.tmpl ++++ b/systemd/cloud-final.service.tmpl +@@ -7,8 +7,10 @@ After=multi-user.target + Before=apt-daily.service + {% endif %} + Wants=network-online.target cloud-config.service ++{% if variant in ["rhel", "ol"] %} + ConditionPathExists=!/etc/cloud/cloud-init.disabled + ConditionKernelCommandLine=!cloud-init=disabled ++{% endif %} + ConditionEnvironment=!KERNEL_CMDLINE=cloud-init=disabled + + +@@ -18,7 +20,7 @@ ExecStart=/usr/bin/cloud-init modules --mode=final + RemainAfterExit=yes + TimeoutSec=0 + KillMode=process +-{% if variant == "rhel" %} ++{% if variant in ["rhel", "ol"] %} + # Restart NetworkManager if it is present and running. + ExecStartPost=/bin/sh -c 'u=NetworkManager.service; \ + out=$(systemctl show --property=SubState $u) || exit; \ +diff --git a/systemd/cloud-init-local.service.tmpl b/systemd/cloud-init-local.service.tmpl +index 3a1ca7f..4750c36 100644 +--- a/systemd/cloud-init-local.service.tmpl ++++ b/systemd/cloud-init-local.service.tmpl +@@ -1,23 +1,25 @@ + ## template:jinja + [Unit] + Description=Initial cloud-init job (pre-networking) +-{% if variant in ["ubuntu", "unknown", "debian", "rhel" ] %} ++{% if variant in ["ubuntu", "unknown", "debian", "rhel", "ol" ] %} + DefaultDependencies=no + {% endif %} + Wants=network-pre.target ++{% if variant not in ["ol"] %} + After=hv_kvp_daemon.service ++{% endif %} + After=systemd-remount-fs.service +-{% if variant == "rhel" %} ++{% if variant in ["rhel", "ol"] %} + Requires=dbus.socket + After=dbus.socket + {% endif %} + Before=NetworkManager.service +-{% if variant == "rhel" %} ++{% if variant in ["rhel", "ol"] %} + Before=network.service + {% endif %} + Before=network-pre.target + Before=shutdown.target +-{% if variant == "rhel" %} ++{% if variant in ["rhel", "ol"] %} + Before=firewalld.target + Conflicts=shutdown.target + {% endif %} +@@ -26,8 +28,10 @@ Before=sysinit.target + Conflicts=shutdown.target + {% endif %} + RequiresMountsFor=/var/lib/cloud ++{% if variant in ["rhel", "ol"] %} + ConditionPathExists=!/etc/cloud/cloud-init.disabled + ConditionKernelCommandLine=!cloud-init=disabled ++{% endif %} + ConditionEnvironment=!KERNEL_CMDLINE=cloud-init=disabled + + [Service] +diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl +index 90d45f2..2e1ce48 100644 +--- a/systemd/cloud-init.service.tmpl ++++ b/systemd/cloud-init.service.tmpl +@@ -1,7 +1,7 @@ + ## template:jinja + [Unit] + Description=Initial cloud-init job (metadata service crawler) +-{% if variant not in ["photon", "rhel"] %} ++{% if variant not in ["photon", "rhel", "ol"] %} + DefaultDependencies=no + {% endif %} + Wants=cloud-init-local.service +@@ -10,13 +10,15 @@ Wants=sshd-keygen@ecdsa.service + Wants=sshd-keygen@ed25519.service + Wants=sshd.service + After=cloud-init-local.service ++{% if variant not in ["ol"] %} + After=systemd-networkd-wait-online.service ++{% endif %} + {% if variant in ["ubuntu", "unknown", "debian"] %} + After=networking.service + {% endif %} + {% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora", + "miraclelinux", "openeuler", "OpenCloudOS", "openmandriva", "rhel", "rocky", +- "suse", "TencentOS", "virtuozzo"] %} ++ "suse", "TencentOS", "virtuozzo", "ol"] %} + + After=network.service + After=NetworkManager.service +@@ -42,8 +44,10 @@ Conflicts=shutdown.target + Before=shutdown.target + Conflicts=shutdown.target + {% endif %} ++{% if variant in ["rhel", "ol"] %} + ConditionPathExists=!/etc/cloud/cloud-init.disabled + ConditionKernelCommandLine=!cloud-init=disabled ++{% endif %} + ConditionEnvironment=!KERNEL_CMDLINE=cloud-init=disabled + + [Service] +diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py +index 519ef63..323e7f6 100644 +--- a/tests/unittests/test_util.py ++++ b/tests/unittests/test_util.py +@@ -1311,6 +1311,7 @@ class TestGetVariant: + ({"system": "linux", "dist": ("sles",)}, "suse"), + ({"system": "linux", "dist": ("sle_hpc",)}, "suse"), + ({"system": "linux", "dist": ("my_distro",)}, "linux"), ++ ({"system": "linux", "dist": ("ol",)}, "ol"), + ({"system": "Windows", "dist": ("dontcare",)}, "windows"), + ({"system": "Darwin", "dist": ("dontcare",)}, "darwin"), + ({"system": "Freebsd", "dist": ("dontcare",)}, "freebsd"), +-- +2.31.1 + diff --git a/SOURCES/orabug35329883-Increase-retry-value-and-add-timeout-for-OCI.patch b/SOURCES/orabug35329883-Increase-retry-value-and-add-timeout-for-OCI.patch new file mode 100644 index 0000000..099a8cc --- /dev/null +++ b/SOURCES/orabug35329883-Increase-retry-value-and-add-timeout-for-OCI.patch @@ -0,0 +1,30 @@ +From ae1b843c7ab8b173ef2ffd9ea02842d1d4455e64 Mon Sep 17 00:00:00 2001 +From: Alexander Burmashev +Date: Fri, 5 May 2023 03:15:06 -0700 +Subject: [PATCH] Increase retry value and add timeout for OCI + +To be sure there are no failures, and accomodate to current behaviour on some supoported shapes it is needed to set +increased values for retries and timeout. + +Orabug: 35329883 + +Signed-off-by: Alex Burmashev +--- + cloudinit/sources/DataSourceOracle.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/cloudinit/sources/DataSourceOracle.py b/cloudinit/sources/DataSourceOracle.py +--- a/cloudinit/sources/DataSourceOracle.py 2023-10-03 22:09:18.480515323 +0000 ++++ b/cloudinit/sources/DataSourceOracle.py 2023-10-03 22:21:31.155006874 +0000 +@@ -364,11 +364,12 @@ + return asset_tag == CHASSIS_ASSET_TAG + + +-def _fetch(metadata_version: int, path: str, retries: int = 2) -> dict: ++def _fetch(metadata_version: int, path: str, retries: int = 9) -> dict: + return readurl( + url=METADATA_PATTERN.format(version=metadata_version, path=path), + headers=V2_HEADERS if metadata_version > 1 else None, + retries=retries, ++ timeout=20, + )._response.json() diff --git a/SOURCES/orabug35950168-DataSourceOracle-network-getdata-updates.patch b/SOURCES/orabug35950168-DataSourceOracle-network-getdata-updates.patch new file mode 100644 index 0000000..b540576 --- /dev/null +++ b/SOURCES/orabug35950168-DataSourceOracle-network-getdata-updates.patch @@ -0,0 +1,140 @@ +From 6a81b1e0970f37246276009c844baca860f3f913 Mon Sep 17 00:00:00 2001 +From: Darren Archibald +Date: Fri, 23 Feb 2024 08:04:44 -0800 +Subject: [PATCH] DataSourceOracle network getdata updates + +Orabug: 35950168 + +Signed-off-by: Darren Archibald +--- + cloudinit/sources/DataSourceOracle.py | 78 +++++++++++++-------------- + 1 file changed, 39 insertions(+), 39 deletions(-) + +diff -git a/cloudinit/sources/DataSourceOracle.py b/cloudinit/sources/DataSourceOracle.py +--- a/cloudinit/sources/DataSourceOracle.py 2024-04-03 15:54:08.713716247 -0700 ++++ b/cloudinit/sources/DataSourceOracle.py 2024-04-03 15:53:35.426718593 -0700 +@@ -20,6 +20,7 @@ + import logging + from collections import namedtuple + from typing import Optional, Tuple ++from contextlib import suppress as noop + + from cloudinit import atomic_helper, dmi, net, sources, util + from cloudinit.distros.networking import NetworkConfig +@@ -37,6 +38,7 @@ + DRACUT_OLDTMP_PATH='/dev/.initramfs' + DRACUT_NET_IFACES='net.ifaces' + DRACUT_IBFT_PATTERN='net.*.has_ibft_config' ++ISCSI_IBFT_PATH='/sys/firmware/acpi/tables/iBFT' + + BUILTIN_DS_CONFIG = { + # Don't use IMDS to configure secondary NICs by default +@@ -129,7 +131,7 @@ + sources.NetworkConfigSource.INITRAMFS, + ) + +- _network_config: dict = {"config": [], "version": 1} ++ _network_config = sources.UNSET + + def __init__(self, sys_cfg, *args, **kwargs): + super(DataSourceOracle, self).__init__(sys_cfg, *args, **kwargs) +@@ -155,14 +157,16 @@ + + self.system_uuid = _read_system_uuid() + +- network_context = ephemeral.EphemeralDHCPv4( +- self.distro, +- iface=net.find_fallback_nic(), +- connectivity_url_data={ +- "url": METADATA_PATTERN.format(version=2, path="instance"), +- "headers": V2_HEADERS, +- }, +- ) ++ network_context = noop() ++ if not self._is_iscsi_root(): ++ network_context = ephemeral.EphemeralDHCPv4( ++ self.distro, ++ iface=net.find_fallback_nic(), ++ connectivity_url_data={ ++ "url": METADATA_PATTERN.format(version=2, path="instance"), ++ "headers": V2_HEADERS, ++ }, ++ ) + fetch_primary_nic = not self._is_iscsi_root() + fetch_secondary_nics = self.ds_cfg.get( + "configure_secondary_nics", +@@ -222,7 +226,7 @@ + + def _is_iscsi_root(self) -> bool: + """Return whether we are on a iscsi machine.""" +- return self._network_config_source.is_applicable() or _is_dracut_netconfig() ++ return self._network_config_source.is_applicable() or bool(os.path.exists(ISCSI_IBFT_PATH)) + + def _get_iscsi_config(self) -> dict: + return self._network_config_source.render_config() +@@ -237,39 +241,36 @@ + + If none is present, then we fall back to fallback configuration. + """ +- if self._has_network_config(): +- return self._network_config +- + set_primary = False +- # this is v1 +- if self._is_iscsi_root(): +- self._network_config = self._get_iscsi_config() +- if not self._has_network_config(): +- LOG.warning( +- "Could not obtain network configuration from initramfs. " +- "Falling back to IMDS." +- ) +- set_primary = True + +- set_secondary = self.ds_cfg.get( +- "configure_secondary_nics", +- BUILTIN_DS_CONFIG["configure_secondary_nics"], +- ) +- if set_primary or set_secondary: +- try: +- # Mutate self._network_config to include primary and/or +- # secondary VNICs +- self._add_network_config_from_opc_imds(set_primary) +- except Exception: +- util.logexc( +- LOG, +- "Failed to parse IMDS network configuration!", ++ if self._network_config == sources.UNSET: ++ # this is v1 ++ self._network_config = cmdline.read_initramfs_config() ++ ++ if not self._network_config: ++ self._network_config = self.distro.generate_fallback_config() ++ set_primary = True ++ ++ set_secondary = self.ds_cfg.get( ++ "configure_secondary_nics", ++ BUILTIN_DS_CONFIG["configure_secondary_nics"], + ) + +- # we need to verify that the nic selected is not a netfail over +- # device and, if it is a netfail master, then we need to avoid +- # emitting any match by mac +- _ensure_netfailover_safe(self._network_config) ++ if set_primary or set_secondary: ++ try: ++ # Mutate self._network_config to include primary and/or ++ # secondary VNICs ++ self._add_network_config_from_opc_imds(set_primary) ++ except Exception: ++ util.logexc( ++ LOG, ++ "Failed to parse IMDS network configuration!", ++ ) ++ ++ # we need to verify that the nic selected is not a netfail over ++ # device and, if it is a netfail master, then we need to avoid ++ # emitting any match by mac ++ _ensure_netfailover_safe(self._network_config) + + return self._network_config + diff --git a/SPECS/cloud-init.spec b/SPECS/cloud-init.spec index dc7e9fe..1512216 100644 --- a/SPECS/cloud-init.spec +++ b/SPECS/cloud-init.spec @@ -1,6 +1,6 @@ Name: cloud-init Version: 23.4 -Release: 19%{?dist}.5 +Release: 19.0.2%{?dist}.6 Summary: Cloud instance init scripts License: ASL 2.0 or GPLv3 URL: http://launchpad.net/cloud-init @@ -81,6 +81,25 @@ Patch39: ci-Prevent-NM-from-handling-DNS-when-network-interfaces.pa Patch40: ci-refactor-Ensure-internal-DNS-state-same-for-v1-and-v.patch # For RHEL-79774 - [RHEL 9] Backport support for smbios datasource definition [rhel-9.5.z] Patch41: ci-fix-nocloud-smbios-datasource-definition.patch +# For RHEL-81163 - Cloud-init fails to subscribe system if activation key 'org' is not an integer [rhel-9.5.z] +Patch42: ci-fix-rh_subscription-add-string-type-to-org-5453.patch + +Patch100: 0041-enable-ec2_utils-to-stop-retrying-to-get-ec2-metadata.patch +Patch101: orabug29956753-DataSourceOracle-_is_iscsi_root-not-working-with-dra.patch +Patch102: ignore-enslaved-interface.patch +Patch103: ol-sysconfig-add-Oracle-Linux-variant-to-known-distros.patch +Patch104: 0106-tests-unittests-add-a-new-unit-test-for-network-mana.patch + +# Oracle patches +Patch1001: orabug30435672-003-cloud-init-collect-logs.patch +Patch1002: orabug30435672-004-ol-cloud-config.patch +Patch1003: orabug30435672-006-cc_spacewalk.py.patch +Patch1005: orabug32183938-009-missing-sshd-services.patch +Patch1006: orabug32183938-010-missing-sshd-services-in-rhel-systemd.patch +Patch1007: orabug34845400-Add-Oracle-to-distro-detection-logic-in-cloud.cfg.tm.patch +Patch1008: orabug35329883-Increase-retry-value-and-add-timeout-for-OCI.patch +Patch1009: orabug35950168-DataSourceOracle-network-getdata-updates.patch +Patch1010: 1010-orabug36958039-Removes-condition-specific-to-OL-for-write_files_def.patch BuildArch: noarch @@ -295,6 +314,35 @@ fi %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %changelog +* Tue May 06 2025 Craig Guiller - 23.4-19.0.2.el9_5.6 +- Fixes regression in cloud-init-23.4-19.0.1 with module cc_write_files_deferred [Orabug: 36958039] +- NetworkManagerActivator brings up interface failed when using sysconfig renderer [RHEL-18981] +- Fix Oracle Datasource network and getdata methods for OCI OL [Orabug: 35950168] +- Increase retry value and add timeout for OCI [Orabug: 35329883] +- Fix log file permission [Orabug: 35302969] +- Update detection logic for OL distros in config template [Orabug: 34845400] +- Added missing services in rhel/systemd/cloud-init.service [Orabug: 32183938] +- Added missing services in cloud-init.service.tmpl for sshd [Orabug: 32183938] +- Forward port applicable cloud-init 18.4-2.0.3 changes to cloud-init-18-5 [Orabug: 30435672] +- limit permissions [Orabug: 31352433] +- Changes to ignore all enslaved interfaces [Orabug: 30092148] +- Make Oracle datasource detect dracut based config files [Orabug: 29956753] +- add modified version of enable-ec2_utils-to-stop-retrying-to-get-ec2-metadata.patch: + 1. Enable ec2_utils.py having a way to stop retrying to get ec2 metadata + 2. Apply stop retrying to get ec2 metadata to helper/openstack.py MetadataReader + Resolves: Oracle-Bug:41660 (Bugzilla) +- added OL to list of known distros +Resolves: rhbz#1427280 +Resolves: rhbz#1427280 + +* Tue May 06 2025 Release Engineering - 23.4.0.2 +- Apply OpenELA fixes + +* Tue Apr 01 2025 Jon Maloy - 23.4-19.el9_5.6 +- ci-fix-rh_subscription-add-string-type-to-org-5453.patch [RHEL-81163] +- Resolves: RHEL-81163 + (Cloud-init fails to subscribe system if activation key 'org' is not an integer [rhel-9.5.z]) + * Mon Feb 24 2025 Jon Maloy - 23.4-19.el9_5.5 - ci-fix-nocloud-smbios-datasource-definition.patch [RHEL-79774] - Resolves: RHEL-79774