Package: release.debian.org Severity: normal Tags: trixie X-Debbugs-Cc: [email protected] Control: affects -1 + src:cloud-init User: [email protected] Usertags: pu
The cloud-team would like to update cloud-init in trixie to fix bug 1118187 [1]. [ Reason ] Cloud-init is optionally able to generate apt sources, allowing users to provision hosts. This is used to ensure hosts are configured to talk to local mirrors and/or private repositories. The cloud-init version currently in trixie contains an upstream bug that results in deb822 sources being incorrectly formatted in a way that makes them invalid. Upstream has fixed the bug in git, and the proposed change cherry-picks their fix. [2] [ Impact ] Without the fix, users will be unable to make use of cloud-init's deb822 source generation and will need to work around this using other means (e.g. by deploying pre-generated sources). [ Tests ] Manual validation, plus a new unit test added with the upstream change. The upstream fix has been included in unstable and testing since version 25.2-1, uploaded in August. [ Risks ] Risk is low as the change is local to the deb822 template file. [ Checklist ] [*] *all* changes are documented in the d/changelog [*] I reviewed all changes and I approve them [*] attach debdiff against the package in (old)stable [*] the issue is verified as fixed in unstable [ Changes ] cloud-init (25.1.4-1+deb13u1) trixie; urgency=medium * Ensure deb822 sources.list template renders correctly (Closes: #1118187) -- Noah Meyerhans <[email protected]> Mon, 10 Nov 2025 11:15:37 -0500 1. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1118187 2. https://github.com/canonical/cloud-init/commit/f21d266eb358b5591128db3b413a72c903cadac1
diff -Nru cloud-init-25.1.4/debian/changelog cloud-init-25.1.4/debian/changelog --- cloud-init-25.1.4/debian/changelog 2025-07-07 15:13:38.000000000 -0400 +++ cloud-init-25.1.4/debian/changelog 2025-11-10 11:15:37.000000000 -0500 @@ -1,3 +1,9 @@ +cloud-init (25.1.4-1+deb13u1) trixie; urgency=medium + + * Ensure deb822 sources.list template renders correctly (Closes: #1118187) + + -- Noah Meyerhans <[email protected]> Mon, 10 Nov 2025 11:15:37 -0500 + cloud-init (25.1.4-1) unstable; urgency=medium * New upstream version 25.1.4 (Closes: #1108402, #1108403) diff -Nru cloud-init-25.1.4/debian/patches/fix-Ensure-822-template-renders-correctly-on-Debian-.patch cloud-init-25.1.4/debian/patches/fix-Ensure-822-template-renders-correctly-on-Debian-.patch --- cloud-init-25.1.4/debian/patches/fix-Ensure-822-template-renders-correctly-on-Debian-.patch 1969-12-31 19:00:00.000000000 -0500 +++ cloud-init-25.1.4/debian/patches/fix-Ensure-822-template-renders-correctly-on-Debian-.patch 2025-11-10 11:12:34.000000000 -0500 @@ -0,0 +1,158 @@ +From f21d266eb358b5591128db3b413a72c903cadac1 Mon Sep 17 00:00:00 2001 +From: James Falcon <[email protected]> +Date: Tue, 12 Aug 2025 13:08:59 -0500 +Subject: [PATCH] fix: Ensure 822 template renders correctly on Debian (#6381) +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1118187 + +Fixes GH-6380 +--- + templates/sources.list.debian.deb822.tmpl | 2 +- + tests/unittests/helpers.py | 10 +++ + tests/unittests/test_render_template.py | 97 +++++++++++++++++++++++ + 3 files changed, 108 insertions(+), 1 deletion(-) + +Index: cloud-init/templates/sources.list.debian.deb822.tmpl +=================================================================== +--- cloud-init.orig/templates/sources.list.debian.deb822.tmpl ++++ cloud-init/templates/sources.list.debian.deb822.tmpl +@@ -29,6 +29,6 @@ Signed-By: {{primary_key | default('/usr + ## Major bug fix updates produced after the final release of the distribution. + Types: deb deb-src + URIs: {{security}} +-Suites: {{codename}}{% if codename in ('buster', 'stretch') %}/updates{% else %}-security{% endif %} ++Suites: {{codename}}{% if codename in ('buster', 'stretch') %}/updates{% else %}-security{% endif +%} + Components: main + Signed-By: {{security_key | default(primary_key, true) | default('/usr/share/keyrings/debian-archive-keyring.gpg', true)}} +Index: cloud-init/tests/unittests/helpers.py +=================================================================== +--- cloud-init.orig/tests/unittests/helpers.py ++++ cloud-init/tests/unittests/helpers.py +@@ -636,6 +636,16 @@ def skipUnlessJinja(): + return skipIf(not JINJA_AVAILABLE, "No jinja dependency present.") + + ++@skipUnlessJinja() ++def skipUnlessJinjaVersionGreaterThan(version=(0, 0, 0)): ++ import jinja2 ++ ++ return skipIf( ++ condition=tuple(map(int, jinja2.__version__.split("."))) < version, ++ reason=f"jinj2 version is less than {version}", ++ ) ++ ++ + def skipIfJinja(): + return skipIf(JINJA_AVAILABLE, "Jinja dependency present.") + +Index: cloud-init/tests/unittests/test_render_template.py +=================================================================== +--- cloud-init.orig/tests/unittests/test_render_template.py ++++ cloud-init/tests/unittests/test_render_template.py +@@ -6,6 +6,7 @@ import pytest + + from cloudinit import subp, templater, util + from tests.helpers import cloud_init_project_dir ++from tests.unittests.helpers import skipUnlessJinjaVersionGreaterThan + + # TODO(Look to align with tools.render-template or cloudinit.distos.OSFAMILIES) + DISTRO_VARIANTS = [ +@@ -121,3 +122,99 @@ class TestRenderCloudCfg: + system_cfg = util.load_yaml(stream.read()) + + assert renderers == system_cfg["system_info"]["network"]["renderers"] ++ ++ ++EXPECTED_DEBIAN = """\ ++deb testmirror testcodename main ++deb-src testmirror testcodename main ++deb testsecurity testcodename-security main ++deb-src testsecurity testcodename-security main ++deb testmirror testcodename-updates main ++deb-src testmirror testcodename-updates main ++deb testmirror testcodename-backports main ++deb-src testmirror testcodename-backports main ++""" ++ ++EXPECTED_DEBIAN_DEB822 = """\ ++Types: deb deb-src ++URIs: testmirror ++Suites: testcodename testcodename-updates testcodename-backports ++Components: main ++Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg ++Types: deb deb-src ++URIs: testsecurity ++Suites: testcodename-security ++Components: main ++Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg ++""" ++ ++EXPECTED_UBUNTU = """\ ++deb testmirror testcodename main restricted ++deb testmirror testcodename-updates main restricted ++deb testmirror testcodename universe ++deb testmirror testcodename-updates universe ++deb testmirror testcodename multiverse ++deb testmirror testcodename-updates multiverse ++deb testmirror testcodename-backports main restricted universe multiverse ++deb testsecurity testcodename-security main restricted ++deb testsecurity testcodename-security universe ++deb testsecurity testcodename-security multiverse ++""" ++ ++EXPECTED_UBUNTU_DEB822 = """\ ++Types: deb ++URIs: testmirror ++Suites: testcodename testcodename-updates testcodename-backports ++Components: main universe restricted multiverse ++Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg ++Types: deb ++URIs: testsecurity ++Suites: testcodename-security ++Components: main universe restricted multiverse ++Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg ++""" ++ ++ ++class TestRenderSourcesList: ++ @pytest.mark.parametrize( ++ "template_path,expected", ++ [ ++ pytest.param( ++ "templates/sources.list.debian.tmpl", ++ EXPECTED_DEBIAN, ++ id="debian", ++ ), ++ pytest.param( ++ "templates/sources.list.debian.deb822.tmpl", ++ EXPECTED_DEBIAN_DEB822, ++ id="debian_822", ++ ), ++ pytest.param( ++ "templates/sources.list.ubuntu.tmpl", ++ EXPECTED_UBUNTU, ++ id="ubuntu", ++ ), ++ pytest.param( ++ "templates/sources.list.ubuntu.deb822.tmpl", ++ EXPECTED_UBUNTU_DEB822, ++ id="ubuntu_822", ++ ), ++ ], ++ ) ++ @skipUnlessJinjaVersionGreaterThan((3, 0, 0)) ++ def test_render_sources_list_templates( ++ self, tmpdir, template_path, expected ++ ): ++ params = { ++ "mirror": "testmirror", ++ "security": "testsecurity", ++ "codename": "testcodename", ++ } ++ template_path = cloud_init_project_dir(template_path) ++ rendered = templater.render_string(open(template_path).read(), params) ++ filtered = "\n".join( ++ line ++ for line in rendered.splitlines() ++ if line.strip() and not line.strip().startswith("#") ++ ) ++ assert filtered.strip() == expected.strip() diff -Nru cloud-init-25.1.4/debian/patches/series cloud-init-25.1.4/debian/patches/series --- cloud-init-25.1.4/debian/patches/series 2025-07-07 15:13:38.000000000 -0400 +++ cloud-init-25.1.4/debian/patches/series 2025-11-10 11:11:49.000000000 -0500 @@ -4,3 +4,4 @@ 0012-Fix-message-when-a-local-is-missing.patch 0001-config-Support-APT-automated-mirror-selection.patch update-sysvinit.patch +fix-Ensure-822-template-renders-correctly-on-Debian-.patch

