From 47e39e15e756e70f1884b66ab629c197e44c153c Mon Sep 17 00:00:00 2001 From: Miroslav Rezanina Date: Thu, 16 May 2024 07:48:10 -0400 Subject: [PATCH] * Thu May 16 2024 Miroslav Rezanina - 23.4-11 - ci-fix-Always-use-single-datasource-if-specified-5098.patch [RHEL-36255] - Resolves: RHEL-36255 ([rhel-9.5] DataSourceNoCloudNet not configurable via config files) --- ...-single-datasource-if-specified-5098.patch | 66 +++++++++++++++++++ cloud-init.spec | 9 ++- 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 ci-fix-Always-use-single-datasource-if-specified-5098.patch diff --git a/ci-fix-Always-use-single-datasource-if-specified-5098.patch b/ci-fix-Always-use-single-datasource-if-specified-5098.patch new file mode 100644 index 0000000..bcb65c9 --- /dev/null +++ b/ci-fix-Always-use-single-datasource-if-specified-5098.patch @@ -0,0 +1,66 @@ +From 62cec1e38e117fe6b24888862576ac57be14bbda Mon Sep 17 00:00:00 2001 +From: James Falcon +Date: Tue, 26 Mar 2024 15:55:50 -0500 +Subject: [PATCH] fix: Always use single datasource if specified (#5098) + +RH-Author: Ani Sinha +RH-MergeRequest: 82: fix: Always use single datasource if specified (#5098) +RH-Jira: RHEL-36255 +RH-Acked-by: Cathy Avery +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/1] 068e97fcc18dd99f1112a9109acdb30fe2880f6e (anisinha/cloud-init) + +This change may require a user to add `None` to the `datasource_list` +defined in `/etc/cloud/cloud.cfg[.d]` if they have a customized +datasource_list and want the DataSourceNone fallback behavior. + +ds-identify would automatically append "None" to the datasource_list +if a single entry was provided in /etc/cloud/cloud.cfg[.d]. +This wasn't a problem in the past as the python code would detect +a single datasource along with None as an indication to automatically +use that datasource. Since the python code no longer does that, +we should ensure that one specified datasource results in one specified +datasource after ds-identify has run. + +Fixes GH-5091 + +(cherry picked from commit cdbbd17ae400e432d13f674c18a6f5c873fa328b) +Signed-off-by: Ani Sinha +--- + tests/unittests/test_ds_identify.py | 2 +- + tools/ds-identify | 6 +++++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/tests/unittests/test_ds_identify.py b/tests/unittests/test_ds_identify.py +index ba0bf779..acbf3f03 100644 +--- a/tests/unittests/test_ds_identify.py ++++ b/tests/unittests/test_ds_identify.py +@@ -522,7 +522,7 @@ class TestDsIdentify(DsIdentifyBase): + mydata = copy.deepcopy(VALID_CFG["Ec2-hvm"]) + cfgpath = "etc/cloud/cloud.cfg.d/myds.cfg" + mydata["files"][cfgpath] = 'datasource_list: ["NoCloud"]\n' +- self._check_via_dict(mydata, rc=RC_FOUND, dslist=["NoCloud", DS_NONE]) ++ self._check_via_dict(mydata, rc=RC_FOUND, dslist=["NoCloud"]) + + def test_configured_list_with_none(self): + """When datasource_list already contains None, None is not added. +diff --git a/tools/ds-identify b/tools/ds-identify +index ec2cc18a..6e49ded3 100755 +--- a/tools/ds-identify ++++ b/tools/ds-identify +@@ -1865,7 +1865,11 @@ _main() { + # if there is only a single entry in $DI_DSLIST + if [ $# -eq 1 ] || [ $# -eq 2 -a "$2" = "None" ] ; then + debug 1 "single entry in datasource_list ($DI_DSLIST) use that." +- found "$@" ++ if [ $# -eq 1 ]; then ++ write_result "datasource_list: [ $1 ]" ++ else ++ found "$@" ++ fi + return + fi + +-- +2.39.3 + diff --git a/cloud-init.spec b/cloud-init.spec index 5d112d9..0af7ec2 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -1,6 +1,6 @@ Name: cloud-init Version: 23.4 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Cloud instance init scripts License: ASL 2.0 or GPLv3 URL: http://launchpad.net/cloud-init @@ -31,6 +31,8 @@ Patch14: ci-feat-apply-global-DNS-to-interfaces-in-network-manag.patch Patch15: ci-fix-Undeprecate-network-in-schema-route-definition-5.patch # For RHEL-32846 - [cloud-init][ESXi]VMware datasource resets on every boot causing it to lose network configuration [rhel-9] Patch16: ci-fix-Fall-back-to-cached-local-ds-if-no-valid-ds-foun.patch +# For RHEL-36255 - [rhel-9.5] DataSourceNoCloudNet not configurable via config files +Patch17: ci-fix-Always-use-single-datasource-if-specified-5098.patch BuildArch: noarch @@ -245,6 +247,11 @@ fi %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %changelog +* Thu May 16 2024 Miroslav Rezanina - 23.4-11 +- ci-fix-Always-use-single-datasource-if-specified-5098.patch [RHEL-36255] +- Resolves: RHEL-36255 + ([rhel-9.5] DataSourceNoCloudNet not configurable via config files) + * Mon Apr 29 2024 Miroslav Rezanina - 23.4-10 - ci-Remove-dependency-on-python3-httpretty.patch [RHEL-33973] - Resolves: RHEL-33973