From 421b4f21fdafe0b61728a99b74d09f40b1198d6f Mon Sep 17 00:00:00 2001 From: Miroslav Rezanina Date: Wed, 26 Jun 2024 06:47:07 -0400 Subject: [PATCH] * Wed Jun 26 2024 Miroslav Rezanina - 24.1.4-10 - ci-feat-sysconfig-Add-DNS-from-interface-config-to-reso.patch [RHEL-44334] - ci-fix-jsonschema-Add-missing-sudo-definition-5418.patch [RHEL-44338] - ci-doc-update-examples-to-reflect-alternative-ways-to-p.patch [RHEL-44338] - ci-Update-pylint-version-to-support-python-3.12-5338.patch [RHEL-44599] - Resolves: RHEL-44334 ([RHEL-10] cloud-init fails to configure DNS search domains) - Resolves: RHEL-44338 ([RHEL-10] fix `SUDO` configuration schema for users and groups) - Resolves: RHEL-44599 ([rhel-10] fix pylint error and support python 3.12) --- ...-version-to-support-python-3.12-5338.patch | 231 ++++++++++++ ...les-to-reflect-alternative-ways-to-p.patch | 51 +++ ...dd-DNS-from-interface-config-to-reso.patch | 352 ++++++++++++++++++ ...ema-Add-missing-sudo-definition-5418.patch | 53 +++ cloud-init.spec | 22 +- 5 files changed, 708 insertions(+), 1 deletion(-) create mode 100644 ci-Update-pylint-version-to-support-python-3.12-5338.patch create mode 100644 ci-doc-update-examples-to-reflect-alternative-ways-to-p.patch create mode 100644 ci-feat-sysconfig-Add-DNS-from-interface-config-to-reso.patch create mode 100644 ci-fix-jsonschema-Add-missing-sudo-definition-5418.patch diff --git a/ci-Update-pylint-version-to-support-python-3.12-5338.patch b/ci-Update-pylint-version-to-support-python-3.12-5338.patch new file mode 100644 index 0000000..b78916d --- /dev/null +++ b/ci-Update-pylint-version-to-support-python-3.12-5338.patch @@ -0,0 +1,231 @@ +From 2865a3c52e72bcf70ef95c8f9787b650addeec51 Mon Sep 17 00:00:00 2001 +From: Ani Sinha +Date: Wed, 29 May 2024 03:34:38 +0530 +Subject: [PATCH 4/4] Update pylint version to support python 3.12 (#5338) + +RH-Author: Ani Sinha +RH-MergeRequest: 93: Update pylint version to support python 3.12 (#5338) +RH-Jira: RHEL-44599 +RH-Acked-by: Emanuele Giuseppe Esposito +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/1] 979ef05888d5d9c0fd81a84249eb86410846ef33 (anisinha/cloud-init) + +Fedora 39 and above comes with python version 3.12. When running `tox -e pylint` +on cloud-init, we may experience issue such as the one reported here: +https://github.com/pylint-dev/pylint/issues/8782 + +Minimum version of pylint required in order to support python 3.12 is 3.0.2. +Please see https://github.com/pylint-dev/astroid/issues/2201 . Upon further +experimentation, it is seen that we need minimum pylint version 3.2.0 for +cloud-init. Update tox.ini in order to use this pylint version. + +Signed-off-by: Ani Sinha +(cherry picked from commit 5ad609ffdf4bb76c5665e12e34e1867b72bd4435) +--- + cloudinit/config/cc_mounts.py | 4 ++++ + cloudinit/distros/bsd.py | 2 ++ + cloudinit/distros/netbsd.py | 2 +- + cloudinit/sources/DataSourceAzure.py | 2 +- + cloudinit/sources/DataSourceEc2.py | 3 ++- + cloudinit/sources/DataSourceLXD.py | 2 +- + tests/integration_tests/conftest.py | 6 +++--- + tests/integration_tests/util.py | 2 +- + tests/unittests/config/test_cc_ntp.py | 2 ++ + tests/unittests/sources/test_gce.py | 1 + + tests/unittests/test_util.py | 2 ++ + tox.ini | 2 +- + 12 files changed, 21 insertions(+), 9 deletions(-) + +diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py +index 4cc32be5..3f690d06 100644 +--- a/cloudinit/config/cc_mounts.py ++++ b/cloudinit/config/cc_mounts.py +@@ -304,6 +304,10 @@ def create_swapfile(fname: str, size: str) -> None: + "bs=1M", + "count=%s" % size, + ] ++ else: ++ raise subp.ProcessExecutionError( ++ "Missing dependency: 'dd' and 'fallocate' are not available" ++ ) + + try: + subp.subp(cmd, capture=True) +diff --git a/cloudinit/distros/bsd.py b/cloudinit/distros/bsd.py +index 995a1ba2..b0e63964 100644 +--- a/cloudinit/distros/bsd.py ++++ b/cloudinit/distros/bsd.py +@@ -120,6 +120,8 @@ class BSD(distros.Distro): + if not self.pkg_cmd_upgrade_prefix: + return + cmd = self.pkg_cmd_upgrade_prefix ++ else: ++ cmd = [] + + if args and isinstance(args, str): + cmd.append(args) +diff --git a/cloudinit/distros/netbsd.py b/cloudinit/distros/netbsd.py +index e8b9bcd5..972528c6 100644 +--- a/cloudinit/distros/netbsd.py ++++ b/cloudinit/distros/netbsd.py +@@ -12,7 +12,7 @@ import cloudinit.distros.bsd + from cloudinit import subp, util + + try: +- import crypt ++ import crypt # pylint: disable=W4901 + + salt = crypt.METHOD_BLOWFISH # pylint: disable=E1101 + blowfish_hash: Any = functools.partial( +diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py +index bd654cc0..11dc6686 100644 +--- a/cloudinit/sources/DataSourceAzure.py ++++ b/cloudinit/sources/DataSourceAzure.py +@@ -49,7 +49,7 @@ from cloudinit.sources.helpers.azure import ( + from cloudinit.url_helper import UrlError + + try: +- import crypt ++ import crypt # pylint: disable=W4901 + + blowfish_hash: Any = functools.partial( + crypt.crypt, salt=f"$6${util.rand_str(strlen=16)}" +diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py +index 1b81b21f..28822e37 100644 +--- a/cloudinit/sources/DataSourceEc2.py ++++ b/cloudinit/sources/DataSourceEc2.py +@@ -333,6 +333,8 @@ class DataSourceEc2(sources.DataSource): + return None + + def wait_for_metadata_service(self): ++ urls = [] ++ start_time = 0 + mcfg = self.ds_cfg + + url_params = self.get_url_params() +@@ -366,7 +368,6 @@ class DataSourceEc2(sources.DataSource): + and self.cloud_name not in IDMSV2_SUPPORTED_CLOUD_PLATFORMS + ): + # if we can't get a token, use instance-id path +- urls = [] + url2base = {} + url_path = "{ver}/meta-data/instance-id".format( + ver=self.min_metadata_version +diff --git a/cloudinit/sources/DataSourceLXD.py b/cloudinit/sources/DataSourceLXD.py +index cd316101..4c95b907 100644 +--- a/cloudinit/sources/DataSourceLXD.py ++++ b/cloudinit/sources/DataSourceLXD.py +@@ -331,7 +331,7 @@ class MetaDataKeys(Flag): + CONFIG = auto() + DEVICES = auto() + META_DATA = auto() +- ALL = CONFIG | DEVICES | META_DATA ++ ALL = CONFIG | DEVICES | META_DATA # pylint: disable=E1131 + + + class _MetaDataReader: +diff --git a/tests/integration_tests/conftest.py b/tests/integration_tests/conftest.py +index ccbf6a71..58133815 100644 +--- a/tests/integration_tests/conftest.py ++++ b/tests/integration_tests/conftest.py +@@ -273,7 +273,7 @@ def _client( + + + @pytest.fixture +-def client( ++def client( # pylint: disable=W0135 + request, fixture_utils, session_cloud, setup_image + ) -> Iterator[IntegrationInstance]: + """Provide a client that runs for every test.""" +@@ -282,7 +282,7 @@ def client( + + + @pytest.fixture(scope="module") +-def module_client( ++def module_client( # pylint: disable=W0135 + request, fixture_utils, session_cloud, setup_image + ) -> Iterator[IntegrationInstance]: + """Provide a client that runs once per module.""" +@@ -291,7 +291,7 @@ def module_client( + + + @pytest.fixture(scope="class") +-def class_client( ++def class_client( # pylint: disable=W0135 + request, fixture_utils, session_cloud, setup_image + ) -> Iterator[IntegrationInstance]: + """Provide a client that runs once per class.""" +diff --git a/tests/integration_tests/util.py b/tests/integration_tests/util.py +index 8ee3631d..cbe00c83 100644 +--- a/tests/integration_tests/util.py ++++ b/tests/integration_tests/util.py +@@ -187,7 +187,7 @@ def wait_for_cloud_init(client: "IntegrationInstance", num_retries: int = 30): + except Exception as e: + last_exception = e + time.sleep(1) +- raise Exception( ++ raise Exception( # pylint: disable=W0719 + "cloud-init status did not return successfully." + ) from last_exception + +diff --git a/tests/unittests/config/test_cc_ntp.py b/tests/unittests/config/test_cc_ntp.py +index 74ccf2de..6f6c3360 100644 +--- a/tests/unittests/config/test_cc_ntp.py ++++ b/tests/unittests/config/test_cc_ntp.py +@@ -249,6 +249,7 @@ class TestNtp(FilesystemMockingTestCase): + ) + + def _get_expected_pools(self, pools, distro, client): ++ expected_pools = None + if client in ["ntp", "chrony"]: + if client == "ntp" and distro == "alpine": + # NTP for Alpine Linux is Busybox's ntp which does not +@@ -264,6 +265,7 @@ class TestNtp(FilesystemMockingTestCase): + return expected_pools + + def _get_expected_servers(self, servers, distro, client): ++ expected_servers = None + if client in ["ntp", "chrony"]: + if client == "ntp" and distro == "alpine": + # NTP for Alpine Linux is Busybox's ntp which only supports +diff --git a/tests/unittests/sources/test_gce.py b/tests/unittests/sources/test_gce.py +index 6fc31ddc..1617f694 100644 +--- a/tests/unittests/sources/test_gce.py ++++ b/tests/unittests/sources/test_gce.py +@@ -101,6 +101,7 @@ class TestDataSourceGCE(test_helpers.ResponsesTestCase): + gce_meta = GCE_META + + def _request_callback(request): ++ recursive = False + url_path = urlparse(request.url).path + if url_path.startswith("/computeMetadata/v1/"): + path = url_path.split("/computeMetadata/v1/")[1:][0] +diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py +index 70edb40b..b534a1a7 100644 +--- a/tests/unittests/test_util.py ++++ b/tests/unittests/test_util.py +@@ -1700,6 +1700,8 @@ class TestRedirectOutputPreexecFn: + args = (test_string, None) + elif request.param == "errfmt": + args = (None, test_string) ++ else: ++ args = (None, None) + with mock.patch(M_PATH + "subprocess.Popen") as m_popen: + util.redirect_output(*args) + +diff --git a/tox.ini b/tox.ini +index 473e937c..85af1a14 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -25,7 +25,7 @@ hypothesis==6.31.6 + hypothesis_jsonschema==0.20.1 + isort==5.10.1 + mypy==0.950 +-pylint==2.13.9 ++pylint==3.2.0 + pytest==7.0.1 + ruff==0.0.285 + types-jsonschema==4.4.2 +-- +2.39.3 + diff --git a/ci-doc-update-examples-to-reflect-alternative-ways-to-p.patch b/ci-doc-update-examples-to-reflect-alternative-ways-to-p.patch new file mode 100644 index 0000000..1f205d4 --- /dev/null +++ b/ci-doc-update-examples-to-reflect-alternative-ways-to-p.patch @@ -0,0 +1,51 @@ +From fba185085b53f7813b433166c00c0249ea4f2ac3 Mon Sep 17 00:00:00 2001 +From: Ani Sinha +Date: Thu, 20 Jun 2024 11:18:40 +0530 +Subject: [PATCH 3/4] doc: update examples to reflect alternative ways to + provide `sudo` option (#5418) + +RH-Author: Ani Sinha +RH-MergeRequest: 91: fix(jsonschema): Add missing sudo definition (#5418) +RH-Jira: RHEL-44338 +RH-Acked-by: Emanuele Giuseppe Esposito +RH-Acked-by: Miroslav Rezanina +RH-Commit: [2/2] fdaf2d29b4e90882435bfcdcb57a3b8a1d574082 (anisinha/cloud-init) + +For creating users and groups, it is possible to pass a `sudo` option to the +config file that accepts a sudo rule. The option can be a sudo rule string, +a list of sudo rule strings or `False` to explicitly deny sudo usage. Update +examples to show how a list of strings can be used with `sudo` option. + +Signed-off-by: Ani Sinha +(cherry picked from commit cbcb05349e35023ee6e81ccaf13e79adb8f65f63) +--- + doc/examples/cloud-config-user-groups.txt | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/doc/examples/cloud-config-user-groups.txt b/doc/examples/cloud-config-user-groups.txt +index 87fc52e8..56eb674f 100644 +--- a/doc/examples/cloud-config-user-groups.txt ++++ b/doc/examples/cloud-config-user-groups.txt +@@ -35,6 +35,10 @@ users: + lock_passwd: true + ssh_authorized_keys: + - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSL7uWGj8cgWyIOaspgKdVy0cKJ+UTjfv7jBOjG2H/GN8bJVXy72XAvnhM0dUM+CCs8FOf0YlPX+Frvz2hKInrmRhZVwRSL129PasD12MlI3l44u6IwS1o/W86Q+tkQYEljtqDOo0a+cOsaZkvUNzUyEXUwz/lmYa6G4hMKZH4NBj7nbAAF96wsMCoyNwbWryBnDYUr6wMbjRR1J9Pw7Xh7WRC73wy4Va2YuOgbD3V/5ZrFPLbWZW/7TFXVrql04QVbyei4aiFR5n//GvoqwQDNe58LmbzX/xvxyKJYdny2zXmdAhMxbrpFQsfpkJ9E/H5w0yOdSvnWbUoG5xNGoOB csmith@fringe ++ - name: testuser ++ gecos: Mr. Test ++ homedir: /local/testdir ++ sudo: ["ALL=(ALL) NOPASSWD:ALL"] + - name: cloudy + gecos: Magic Cloud App Daemon User + inactive: '5' +@@ -100,6 +104,8 @@ users: + # + # Allow a user unrestricted sudo access. + # sudo: ALL=(ALL) NOPASSWD:ALL ++# or ++# sudo: ["ALL=(ALL) NOPASSWD:ALL"] + # + # Adding multiple sudo rule strings. + # sudo: +-- +2.39.3 + diff --git a/ci-feat-sysconfig-Add-DNS-from-interface-config-to-reso.patch b/ci-feat-sysconfig-Add-DNS-from-interface-config-to-reso.patch new file mode 100644 index 0000000..54a569b --- /dev/null +++ b/ci-feat-sysconfig-Add-DNS-from-interface-config-to-reso.patch @@ -0,0 +1,352 @@ +From 6090957ba065b799f03eb1f767653d7ce65c59e7 Mon Sep 17 00:00:00 2001 +From: Ani Sinha +Date: Thu, 20 Jun 2024 22:27:03 +0530 +Subject: [PATCH 1/4] feat(sysconfig): Add DNS from interface config to + resolv.conf (#5401) + +RH-Author: Ani Sinha +RH-MergeRequest: 89: feat(sysconfig): Add DNS from interface config to resolv.conf (#5401) +RH-Jira: RHEL-44334 +RH-Acked-by: Emanuele Giuseppe Esposito +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/1] 71e88f087df08ddf6247faea2a5239ae02090bc9 (anisinha/cloud-init) + +sysconfig renderer currently only uses global dns and search domain +configuration in order to populate /etc/resolv.conf. This means it ignores +interface specific dns configuration completely. This means, when global dns +information is absent and only interface specific dns configuration is present, +/etc/resolv.conf will not have complete dns information. Fix this so that +per interface dns information is also taken into account along with global dns +configuration in order to populate /etc/resolv.conf. + +Fixes: GH-5400 + +Signed-off-by: Ani Sinha +(cherry picked from commit 1b8030e0c7fd6fbff7e38ad1e3e6266ae50c83a5) +--- + cloudinit/net/sysconfig.py | 52 +++++++++- + tests/unittests/test_net.py | 184 +++++++++++++++++++++++++++++++++++- + 2 files changed, 230 insertions(+), 6 deletions(-) + +diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py +index 1678fcde..32ee7901 100644 +--- a/cloudinit/net/sysconfig.py ++++ b/cloudinit/net/sysconfig.py +@@ -825,11 +825,53 @@ class Renderer(renderer.Renderer): + + @staticmethod + def _render_dns(network_state, existing_dns_path=None): +- # skip writing resolv.conf if network_state doesn't include any input. ++ ++ found_nameservers = [] ++ found_dns_search = [] ++ ++ for iface in network_state.iter_interfaces(): ++ for subnet in iface["subnets"]: ++ # Add subnet-level DNS ++ if "dns_nameservers" in subnet: ++ found_nameservers.extend(subnet["dns_nameservers"]) ++ if "dns_search" in subnet: ++ found_dns_search.extend(subnet["dns_search"]) ++ ++ # Add interface-level DNS ++ if "dns" in iface: ++ found_nameservers += [ ++ dns ++ for dns in iface["dns"]["nameservers"] ++ if dns not in found_nameservers ++ ] ++ found_dns_search += [ ++ search ++ for search in iface["dns"]["search"] ++ if search not in found_dns_search ++ ] ++ ++ # When both global and interface specific entries are present, ++ # use them both to generate /etc/resolv.conf eliminating duplicate ++ # entries. Otherwise use global or interface specific entries whichever ++ # is provided. ++ if network_state.dns_nameservers: ++ found_nameservers += [ ++ nameserver ++ for nameserver in network_state.dns_nameservers ++ if nameserver not in found_nameservers ++ ] ++ if network_state.dns_searchdomains: ++ found_dns_search += [ ++ search ++ for search in network_state.dns_searchdomains ++ if search not in found_dns_search ++ ] ++ ++ # skip writing resolv.conf if no dns information is provided in conf. + if not any( + [ +- len(network_state.dns_nameservers), +- len(network_state.dns_searchdomains), ++ len(found_nameservers), ++ len(found_dns_search), + ] + ): + return None +@@ -838,9 +880,9 @@ class Renderer(renderer.Renderer): + content = resolv_conf.ResolvConf( + util.load_text_file(existing_dns_path) + ) +- for nameserver in network_state.dns_nameservers: ++ for nameserver in found_nameservers: + content.add_nameserver(nameserver) +- for searchdomain in network_state.dns_searchdomains: ++ for searchdomain in found_dns_search: + content.add_search_domain(searchdomain) + header = _make_header(";") + content_str = str(content) +diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py +index fee8e035..de149f5e 100644 +--- a/tests/unittests/test_net.py ++++ b/tests/unittests/test_net.py +@@ -516,6 +516,8 @@ OS_SAMPLES = [ + } + ], + "ip_address": "172.19.1.34", ++ "dns_search": ["testweb.com"], ++ "dns_nameservers": ["172.19.0.13"], + "id": "network0", + } + ], +@@ -550,7 +552,9 @@ STARTMODE=auto + """ + ; Created by cloud-init automatically, do not edit. + ; ++nameserver 172.19.0.13 + nameserver 172.19.0.12 ++search testweb.com + """.lstrip(), + ), + ( +@@ -582,6 +586,8 @@ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEFROUTE=yes + DEVICE=eth0 ++DNS1=172.19.0.13 ++DOMAIN=testweb.com + GATEWAY=172.19.3.254 + HWADDR=fa:16:3e:ed:9a:59 + IPADDR=172.19.1.34 +@@ -596,7 +602,174 @@ USERCTL=no + """ + ; Created by cloud-init automatically, do not edit. + ; ++nameserver 172.19.0.13 + nameserver 172.19.0.12 ++search testweb.com ++""".lstrip(), ++ ), ++ ( ++ "etc/NetworkManager/conf.d/99-cloud-init.conf", ++ """ ++# Created by cloud-init automatically, do not edit. ++# ++[main] ++dns = none ++""".lstrip(), ++ ), ++ ( ++ "etc/udev/rules.d/70-persistent-net.rules", ++ "".join( ++ [ ++ 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ', ++ 'ATTR{address}=="fa:16:3e:ed:9a:59", NAME="eth0"\n', ++ ] ++ ), ++ ), ++ ], ++ "expected_network_manager": [ ++ ( ++ "".join( ++ [ ++ "etc/NetworkManager/system-connections", ++ "/cloud-init-eth0.nmconnection", ++ ] ++ ), ++ """ ++# Generated by cloud-init. Changes will be lost. ++ ++[connection] ++id=cloud-init eth0 ++uuid=1dd9a779-d327-56e1-8454-c65e2556c12c ++autoconnect-priority=120 ++type=ethernet ++ ++[user] ++org.freedesktop.NetworkManager.origin=cloud-init ++ ++[ethernet] ++mac-address=FA:16:3E:ED:9A:59 ++ ++[ipv4] ++method=manual ++may-fail=false ++address1=172.19.1.34/22 ++route1=0.0.0.0/0,172.19.3.254 ++dns=172.19.0.13; ++dns-search=testweb.com; ++ ++""".lstrip(), ++ ), ++ ], ++ }, ++ { ++ "in_data": { ++ "services": [ ++ { ++ "type": "dns", ++ "address": "172.19.0.12", ++ "search": ["example1.com", "example2.com"], ++ } ++ ], ++ "networks": [ ++ { ++ "network_id": "dacd568d-5be6-4786-91fe-750c374b78b4", ++ "type": "ipv4", ++ "netmask": "255.255.252.0", ++ "link": "eth0", ++ "routes": [ ++ { ++ "netmask": "0.0.0.0", ++ "network": "0.0.0.0", ++ "gateway": "172.19.3.254", ++ } ++ ], ++ "ip_address": "172.19.1.34", ++ "dns_search": ["example3.com"], ++ "dns_nameservers": ["172.19.0.12"], ++ "id": "network0", ++ } ++ ], ++ "links": [ ++ { ++ "ethernet_mac_address": "fa:16:3e:ed:9a:59", ++ "mtu": None, ++ "type": "physical", ++ "id": "eth0", ++ }, ++ ], ++ }, ++ "in_macs": { ++ "fa:16:3e:ed:9a:59": "eth0", ++ }, ++ "out_sysconfig_opensuse": [ ++ ( ++ "etc/sysconfig/network/ifcfg-eth0", ++ """ ++# Created by cloud-init automatically, do not edit. ++# ++BOOTPROTO=static ++IPADDR=172.19.1.34 ++LLADDR=fa:16:3e:ed:9a:59 ++NETMASK=255.255.252.0 ++STARTMODE=auto ++""".lstrip(), ++ ), ++ ( ++ "etc/resolv.conf", ++ """ ++; Created by cloud-init automatically, do not edit. ++; ++nameserver 172.19.0.12 ++search example3.com example1.com example2.com ++""".lstrip(), ++ ), ++ ( ++ "etc/NetworkManager/conf.d/99-cloud-init.conf", ++ """ ++# Created by cloud-init automatically, do not edit. ++# ++[main] ++dns = none ++""".lstrip(), ++ ), ++ ( ++ "etc/udev/rules.d/85-persistent-net-cloud-init.rules", ++ "".join( ++ [ ++ 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ', ++ 'ATTR{address}=="fa:16:3e:ed:9a:59", NAME="eth0"\n', ++ ] ++ ), ++ ), ++ ], ++ "out_sysconfig_rhel": [ ++ ( ++ "etc/sysconfig/network-scripts/ifcfg-eth0", ++ """ ++# Created by cloud-init automatically, do not edit. ++# ++AUTOCONNECT_PRIORITY=120 ++BOOTPROTO=none ++DEFROUTE=yes ++DEVICE=eth0 ++DNS1=172.19.0.12 ++DOMAIN=example3.com ++GATEWAY=172.19.3.254 ++HWADDR=fa:16:3e:ed:9a:59 ++IPADDR=172.19.1.34 ++NETMASK=255.255.252.0 ++ONBOOT=yes ++TYPE=Ethernet ++USERCTL=no ++""".lstrip(), ++ ), ++ ( ++ "etc/resolv.conf", ++ """ ++; Created by cloud-init automatically, do not edit. ++; ++nameserver 172.19.0.12 ++search example3.com example1.com example2.com + """.lstrip(), + ), + ( +@@ -647,6 +820,7 @@ may-fail=false + address1=172.19.1.34/22 + route1=0.0.0.0/0,172.19.3.254 + dns=172.19.0.12; ++dns-search=example3.com; + + """.lstrip(), + ), +@@ -654,7 +828,13 @@ dns=172.19.0.12; + }, + { + "in_data": { +- "services": [{"type": "dns", "address": "172.19.0.12"}], ++ "services": [ ++ { ++ "type": "dns", ++ "address": "172.19.0.12", ++ "search": "example.com", ++ } ++ ], + "networks": [ + { + "network_id": "public-ipv4", +@@ -715,6 +895,7 @@ STARTMODE=auto + ; Created by cloud-init automatically, do not edit. + ; + nameserver 172.19.0.12 ++search example.com + """.lstrip(), + ), + ( +@@ -763,6 +944,7 @@ USERCTL=no + ; Created by cloud-init automatically, do not edit. + ; + nameserver 172.19.0.12 ++search example.com + """.lstrip(), + ), + ( +-- +2.39.3 + diff --git a/ci-fix-jsonschema-Add-missing-sudo-definition-5418.patch b/ci-fix-jsonschema-Add-missing-sudo-definition-5418.patch new file mode 100644 index 0000000..ac405aa --- /dev/null +++ b/ci-fix-jsonschema-Add-missing-sudo-definition-5418.patch @@ -0,0 +1,53 @@ +From 77fdb71d8947b4bc3b0fb19c2a0dbf0423c51163 Mon Sep 17 00:00:00 2001 +From: Brett Holman +Date: Wed, 19 Jun 2024 17:07:56 -0600 +Subject: [PATCH 2/4] fix(jsonschema): Add missing sudo definition (#5418) + +RH-Author: Ani Sinha +RH-MergeRequest: 91: fix(jsonschema): Add missing sudo definition (#5418) +RH-Jira: RHEL-44338 +RH-Acked-by: Emanuele Giuseppe Esposito +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/2] c94e7e63470d04c23ebb45fe654c7bdd5a30c162 (anisinha/cloud-init) + +This configuration: + +``` +users: + - name: osadmin + lock_passwd: false + sudo: ["ALL=(ALL) NOPASSWD:ALL"] +``` + +Is valid syntax but is missing from the jsonschema definition. + +Fixes GH-5399 + +(cherry picked from commit b533fa51acb850ed754e2b1925e276ff8e5f3507) +--- + cloudinit/config/schemas/schema-cloud-config-v1.json | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/cloudinit/config/schemas/schema-cloud-config-v1.json b/cloudinit/config/schemas/schema-cloud-config-v1.json +index ff61dcaa..c47e7c4f 100644 +--- a/cloudinit/config/schemas/schema-cloud-config-v1.json ++++ b/cloudinit/config/schemas/schema-cloud-config-v1.json +@@ -388,6 +388,15 @@ + ], + "description": "Sudo rule to use or false. Absence of a sudo value or ``null`` will result in no sudo rules added for this user." + }, ++ { ++ "type": "array", ++ "items": { ++ "type": [ ++ "string", ++ "null" ++ ] ++ } ++ }, + { + "type": "boolean", + "changed": true, +-- +2.39.3 + diff --git a/cloud-init.spec b/cloud-init.spec index 4792948..49556a2 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -6,7 +6,7 @@ Name: cloud-init Version: 24.1.4 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Cloud instance init scripts License: Apache-2.0 OR GPL-3.0-only URL: https://github.com/canonical/cloud-init @@ -25,6 +25,14 @@ Patch7: ci-refactor-remove-dependency-on-netifaces-4634.patch Patch8: ci-DS-VMware-Fix-ipv6-addr-converter-from-netinfo-to-ne.patch # For RHEL-36456 - [RHEL-10] Group ssh_keys is missing and ssh host key permission is changed in rhel-10 Patch9: ci-feat-Set-RH-ssh-key-permissions-when-no-ssh_keys-gro.patch +# For RHEL-44334 - [RHEL-10] cloud-init fails to configure DNS search domains +Patch10: ci-feat-sysconfig-Add-DNS-from-interface-config-to-reso.patch +# For RHEL-44338 - [RHEL-10] fix `SUDO` configuration schema for users and groups +Patch11: ci-fix-jsonschema-Add-missing-sudo-definition-5418.patch +# For RHEL-44338 - [RHEL-10] fix `SUDO` configuration schema for users and groups +Patch12: ci-doc-update-examples-to-reflect-alternative-ways-to-p.patch +# For RHEL-44599 - [rhel-10] fix pylint error and support python 3.12 +Patch13: ci-Update-pylint-version-to-support-python-3.12-5338.patch BuildArch: noarch @@ -236,6 +244,18 @@ fi %changelog +* Wed Jun 26 2024 Miroslav Rezanina - 24.1.4-10 +- ci-feat-sysconfig-Add-DNS-from-interface-config-to-reso.patch [RHEL-44334] +- ci-fix-jsonschema-Add-missing-sudo-definition-5418.patch [RHEL-44338] +- ci-doc-update-examples-to-reflect-alternative-ways-to-p.patch [RHEL-44338] +- ci-Update-pylint-version-to-support-python-3.12-5338.patch [RHEL-44599] +- Resolves: RHEL-44334 + ([RHEL-10] cloud-init fails to configure DNS search domains) +- Resolves: RHEL-44338 + ([RHEL-10] fix `SUDO` configuration schema for users and groups) +- Resolves: RHEL-44599 + ([rhel-10] fix pylint error and support python 3.12) + * Mon Jun 24 2024 Troy Dawson - 24.1.4-9 - Bump release for June 2024 mass rebuild