fix: upgrade cloud-init to v23.4.1 and add patch to retain exit code for recoverable errors (#7211)
Reverts the revert of cloud-init v23.4.1 and adds a patch backport to gracefully handle the new status exit code behavior which caused a regression in our extended testing apparatus, prompting the initial revert.
From https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/2048522
cloud-init status introduced a new exit code of 2 with the meaning of recoverable errors / warnings.
Without this fix, status exited with 2 in cases where previously did it with 0, potentially breaking consumers (scripts or other programs) of cloud-init status.
The fix is to include a quilt patch retaining the exit code of 0 for recoverable errors / warnings for stable releases.
Fixes: 1a57d91
("Revert "fix: upgrade cloud-init to v23.4.1"")
Signed-off-by: Chris Co chrco@microsoft.com
This commit is contained in:
parent
971e0e8a4d
commit
4d35b64e41
|
@ -0,0 +1,46 @@
|
|||
From 66d82824f7ab18d12ca8020f6df31ce1c19e550c Mon Sep 17 00:00:00 2001
|
||||
From: Chris Co <chrco@microsoft.com>
|
||||
Date: Wed, 10 Jan 2024 06:21:24 +0000
|
||||
Subject: [PATCH] Retain exit code in cloud-init status for recoverable errors
|
||||
|
||||
Description: Retain exit code in cloud-init status for recoverable errors
|
||||
(LP: #2048522).
|
||||
Author: Alberto Contreras <alberto.contreras@canonical.com>
|
||||
Last-Update: 2024-01-08
|
||||
---
|
||||
|
||||
Modifed-by: Chris Co <chrco@microsoft.com>
|
||||
---
|
||||
cloudinit/cmd/status.py | 2 +-
|
||||
tests/unittests/cmd/test_status.py | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/cloudinit/cmd/status.py b/cloudinit/cmd/status.py
|
||||
index 249fc91..7bdfa4b 100644
|
||||
--- a/cloudinit/cmd/status.py
|
||||
+++ b/cloudinit/cmd/status.py
|
||||
@@ -225,7 +225,7 @@ def handle_status_args(name, args) -> int:
|
||||
return 1
|
||||
# Recoverable error
|
||||
elif details.status in UXAppStatusDegradedMap.values():
|
||||
- return 2
|
||||
+ return 0
|
||||
return 0
|
||||
|
||||
|
||||
diff --git a/tests/unittests/cmd/test_status.py b/tests/unittests/cmd/test_status.py
|
||||
index 6e4eac4..244acc1 100644
|
||||
--- a/tests/unittests/cmd/test_status.py
|
||||
+++ b/tests/unittests/cmd/test_status.py
|
||||
@@ -644,7 +644,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
|
||||
},
|
||||
None,
|
||||
MyArgs(long=False, wait=False, format="json"),
|
||||
- 2,
|
||||
+ 0,
|
||||
{
|
||||
"boot_status_code": "enabled-by-kernel-cmdline",
|
||||
"datasource": "nocloud",
|
||||
--
|
||||
2.33.8
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"Signatures": {
|
||||
"10-azure-kvp.cfg": "79e0370c010be5cd4717960e4b414570c9ec6e6d29aede77ccecc43d2b03bb9a",
|
||||
"cloud-init-23.3.tar.gz": "1a5a54369f78891b79f43061c1ff0fb31e2bd74ff9527d7150ddd6517c3e2b07"
|
||||
"cloud-init-23.4.1.tar.gz": "f12d207cf147ab981787487d38cda09ee71975505df224c96a6cf1d59f53ca2f"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
%define upstream_version_group 23.3.3
|
||||
%define package_version %(echo %{upstream_version_group} | cut -d. -f1-2)
|
||||
|
||||
Summary: Cloud instance init scripts
|
||||
Name: cloud-init
|
||||
Version: %{package_version}
|
||||
Version: 23.4.1
|
||||
Release: 2%{?dist}
|
||||
License: GPLv3
|
||||
Vendor: Microsoft Corporation
|
||||
Distribution: Mariner
|
||||
Group: System Environment/Base
|
||||
URL: https://launchpad.net/cloud-init
|
||||
Source0: https://launchpad.net/cloud-init/trunk/%{upstream_version_group}/+download/%{name}-%{version}.tar.gz
|
||||
Source0: https://launchpad.net/cloud-init/trunk/%{version}/+download/%{name}-%{version}.tar.gz
|
||||
Source1: 10-azure-kvp.cfg
|
||||
Patch0: overrideDatasourceDetection.patch
|
||||
Patch0: Retain-exit-code-in-cloud-init-status-for-recoverabl.patch
|
||||
%define cl_services cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service
|
||||
BuildRequires: automake
|
||||
BuildRequires: dbus
|
||||
|
@ -85,7 +82,7 @@ python3 setup.py build
|
|||
%install
|
||||
%{py3_install "--init-system=systemd"}
|
||||
|
||||
python3 tools/render-cloudcfg --variant mariner > %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg
|
||||
python3 tools/render-template --variant mariner > %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg
|
||||
sed -i "s,@@PACKAGED_VERSION@@,%{version}-%{release}," %{buildroot}/%{python3_sitelib}/cloudinit/version.py
|
||||
|
||||
%if "%{_arch}" == "aarch64"
|
||||
|
@ -148,6 +145,13 @@ make check %{?_smp_mflags}
|
|||
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/10-azure-kvp.cfg
|
||||
|
||||
%changelog
|
||||
* Fri Jan 19 2024 Chris Co <chrco@microsoft.com> - 23.4.1-2
|
||||
- Add patch to retain exit code for recoverable errors
|
||||
|
||||
* Fri Jan 19 2024 Chris Co <chrco@microsoft.com> - 23.4.1-1
|
||||
- Upgrade cloud-init to 23.4.1
|
||||
- Remove overrideDatasourceDetection patch since it is now in 23.4 source
|
||||
|
||||
* Thu Jan 18 2024 Pawel Winogrodzki <pawelwi@microsoft.com> - 23.3-2
|
||||
- Switching to our version of 'jsonschema' to keep the tests more stable.
|
||||
- Fixing source URL.
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
From 35988cc4452f7df42e3c1b462731489bd33dade6 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Patterson <cpatterson@microsoft.com>
|
||||
Date: Mon, 11 Sep 2023 16:56:06 -0400
|
||||
Subject: [PATCH] sources: do not override datasource detection if None is in
|
||||
list
|
||||
|
||||
Users with datasource_list = [Azure, None] started failing to boot
|
||||
properly outside of Azure with the changes to override datasource detection.
|
||||
|
||||
If the fallback "None" is included in the datasource_list, do not treat
|
||||
the system as configured with a single datasource.
|
||||
|
||||
If users want to force a single datasource regardless of detection,
|
||||
they can do so by removing None from the list.
|
||||
|
||||
Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
|
||||
---
|
||||
cloudinit/sources/__init__.py | 5 +----
|
||||
1 file changed, 1 insertion(+), 4 deletions(-)
|
||||
|
||||
diff -ruN a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
|
||||
--- a/cloudinit/sources/__init__.py 2023-08-28 09:20:24.000000000 -0700
|
||||
+++ b/cloudinit/sources/__init__.py 2023-09-13 15:00:23.287549869 -0700
|
||||
@@ -352,10 +352,7 @@
|
||||
self,
|
||||
)
|
||||
return True
|
||||
- elif self.sys_cfg.get("datasource_list", []) in (
|
||||
- [self.dsname],
|
||||
- [self.dsname, "None"],
|
||||
- ):
|
||||
+ elif self.sys_cfg.get("datasource_list", []) == [self.dsname]:
|
||||
LOG.debug(
|
||||
"Machine is configured to run on single datasource %s.", self
|
||||
)
|
|
@ -1807,8 +1807,8 @@
|
|||
"type": "other",
|
||||
"other": {
|
||||
"name": "cloud-init",
|
||||
"version": "23.3",
|
||||
"downloadUrl": "https://launchpad.net/cloud-init/trunk/23.3.3/+download/cloud-init-23.3.tar.gz"
|
||||
"version": "23.4.1",
|
||||
"downloadUrl": "https://launchpad.net/cloud-init/trunk/23.4.1/+download/cloud-init-23.4.1.tar.gz"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue