diff -Nru cloud-init-22.3-13-g70ce6442/ChangeLog cloud-init-22.3.3/ChangeLog --- cloud-init-22.3-13-g70ce6442/ChangeLog 2022-08-30 19:26:03.000000000 +0000 +++ cloud-init-22.3.3/ChangeLog 2022-09-19 17:14:49.000000000 +0000 @@ -1,3 +1,29 @@ +22.3.3 + - Fix Oracle DS not setting subnet when using IMDS (LP: #1989686) + +22.3.2 + - azure: define new attribute for pre-22.3 pickles (#1725) + - sources/azure: ensure instance id is always correct (#1727) + +22.3.1 + - Fix v2 interface matching when no MAC (LP: #1986551) + - test: reduce number of network dependencies in flaky test (#1702) + - docs: publish cc_ubuntu_autoinstall docs to rtd (#1696) + - net: Fix EphemeraIPNetwork (#1697) [Alberto Contreras] + - test: make ansible test work across older versions (#1691) + - Networkd multi-address support/fix (#1685) [Teodor Garzdin] + - make: drop broken targets (#1688) + - net: Passthough v2 netconfigs in netplan systems (#1650) + [Alberto Contreras] (LP: #1978543) + - NM ipv6 connection does not work on Azure and Openstack (#1616) + [Emanuele Giuseppe Esposito] + - Fix check_format_tip (#1679) [Alberto Contreras] + - DataSourceVMware: fix var use before init (#1674) + [Andrew Kutz] (LP: #1987005) + - rpm/copr: ensure RPM represents new clean.d dir artifacts (#1680) + - test: avoid centos leaked check of /etc/yum.repos.d/epel-testing.repo + (#1676) + 22.3 - sources: obj.pkl cache should be written anyime get_data is run (#1669) - schema: drop release number from version file (#1664) diff -Nru cloud-init-22.3-13-g70ce6442/cloudinit/sources/DataSourceAzure.py cloud-init-22.3.3/cloudinit/sources/DataSourceAzure.py --- cloud-init-22.3-13-g70ce6442/cloudinit/sources/DataSourceAzure.py 2022-08-30 19:26:03.000000000 +0000 +++ cloud-init-22.3.3/cloudinit/sources/DataSourceAzure.py 2022-09-19 17:14:49.000000000 +0000 @@ -357,6 +357,9 @@ self._ephemeral_dhcp_ctx = None self._iso_dev = None self._wireserver_endpoint = DEFAULT_WIRESERVER_ENDPOINT + self._reported_ready_marker_file = os.path.join( + self.paths.cloud_dir, "data", "reported_ready" + ) def __str__(self): root = sources.DataSource.__str__(self) @@ -820,6 +823,11 @@ ) return {} + def get_instance_id(self): + if not self.metadata or "instance-id" not in self.metadata: + return self._iid() + return str(self.metadata["instance-id"]) + def device_name_to_device(self, name): return self.ds_cfg["disk_aliases"].get(name) diff -Nru cloud-init-22.3-13-g70ce6442/cloudinit/sources/DataSourceOracle.py cloud-init-22.3.3/cloudinit/sources/DataSourceOracle.py --- cloud-init-22.3-13-g70ce6442/cloudinit/sources/DataSourceOracle.py 2022-08-30 19:26:03.000000000 +0000 +++ cloud-init-22.3.3/cloudinit/sources/DataSourceOracle.py 2022-09-19 17:14:49.000000000 +0000 @@ -14,6 +14,7 @@ """ import base64 +import ipaddress from collections import namedtuple from typing import Optional, Tuple @@ -295,11 +296,14 @@ ) continue name = interfaces_by_mac[mac_address] + prefix = ipaddress.ip_network( + vnic_dict["subnetCidrBlock"] + ).prefixlen if self._network_config["version"] == 1: subnet = { "type": "static", - "address": vnic_dict["privateIp"], + "address": f"{vnic_dict['privateIp']}/{prefix}", } self._network_config["config"].append( { @@ -312,7 +316,7 @@ ) elif self._network_config["version"] == 2: self._network_config["ethernets"][name] = { - "addresses": [vnic_dict["privateIp"]], + "addresses": [f"{vnic_dict['privateIp']}/{prefix}"], "mtu": MTU, "dhcp4": False, "dhcp6": False, diff -Nru cloud-init-22.3-13-g70ce6442/cloudinit/version.py cloud-init-22.3.3/cloudinit/version.py --- cloud-init-22.3-13-g70ce6442/cloudinit/version.py 2022-08-30 19:26:03.000000000 +0000 +++ cloud-init-22.3.3/cloudinit/version.py 2022-09-19 17:14:49.000000000 +0000 @@ -4,7 +4,7 @@ # # This file is part of cloud-init. See LICENSE file for license information. -__VERSION__ = "22.3" +__VERSION__ = "22.3.3" _PACKAGED_VERSION = "@@PACKAGED_VERSION@@" FEATURES = [ diff -Nru cloud-init-22.3-13-g70ce6442/debian/changelog cloud-init-22.3.3/debian/changelog --- cloud-init-22.3-13-g70ce6442/debian/changelog 2022-08-30 21:16:38.000000000 +0000 +++ cloud-init-22.3.3/debian/changelog 2022-09-21 20:27:01.000000000 +0000 @@ -1,3 +1,14 @@ +cloud-init (22.3.3-0ubuntu1~22.04.1) jammy; urgency=medium + + * New upstream bugfix release. (LP: #1987318) + + Release 22.3.3 + + Fix Oracle DS not setting subnet when using IMDS (#1735) + + azure: define new attribute for pre-22.3 pickles (#1725) + + sources/azure: ensure instance id is always correct (#1727) + [Chris Patterson] + + -- Brett Holman Wed, 21 Sep 2022 14:27:01 -0600 + cloud-init (22.3-13-g70ce6442-0ubuntu1~22.04.1) jammy; urgency=medium * d/control: add python3-debconf to Depends and Build-Depends Binary files /tmp/tmp_730jq92/2RFDnC7HUx/cloud-init-22.3-13-g70ce6442/tests/data/old_pickles/focal-azure-20.1-10-g71af48df-0ubuntu5.pkl and /tmp/tmp_730jq92/NTIYUlZilz/cloud-init-22.3.3/tests/data/old_pickles/focal-azure-20.1-10-g71af48df-0ubuntu5.pkl differ diff -Nru cloud-init-22.3-13-g70ce6442/tests/integration_tests/test_upgrade.py cloud-init-22.3.3/tests/integration_tests/test_upgrade.py --- cloud-init-22.3-13-g70ce6442/tests/integration_tests/test_upgrade.py 2022-08-30 19:26:03.000000000 +0000 +++ cloud-init-22.3.3/tests/integration_tests/test_upgrade.py 2022-09-19 17:14:49.000000000 +0000 @@ -95,7 +95,12 @@ # have broken across re-constitution of a cached datasource. Some # platforms invalidate their datasource cache on reboot, so we run # it here to ensure we get a dirty run. - assert instance.execute("cloud-init init").ok + assert instance.execute( + "cloud-init init --local; " + "cloud-init init; " + "cloud-init modules --mode=config; " + "cloud-init modules --mode=final" + ).ok # Reboot instance.execute("hostname something-else") @@ -185,4 +190,6 @@ source, take_snapshot=False, clean=False ) instance.restart() + log = instance.read_from_file("/var/log/cloud-init.log") + verify_clean_log(log) assert instance.execute("cloud-init status --wait --long").ok diff -Nru cloud-init-22.3-13-g70ce6442/tests/integration_tests/util.py cloud-init-22.3.3/tests/integration_tests/util.py --- cloud-init-22.3-13-g70ce6442/tests/integration_tests/util.py 2022-08-30 19:26:03.000000000 +0000 +++ cloud-init-22.3.3/tests/integration_tests/util.py 2022-09-19 17:14:49.000000000 +0000 @@ -47,6 +47,12 @@ ) log = "\n".join(log_lines) + error_logs = re.findall("ERROR.*", log) + if error_logs: + raise AssertionError( + "Found unexpected errors: %s" % "\n".join(error_logs) + ) + warning_count = log.count("WARN") expected_warnings = 0 traceback_count = log.count("Traceback") diff -Nru cloud-init-22.3-13-g70ce6442/tests/unittests/sources/test_azure.py cloud-init-22.3.3/tests/unittests/sources/test_azure.py --- cloud-init-22.3-13-g70ce6442/tests/unittests/sources/test_azure.py 2022-08-30 19:26:03.000000000 +0000 +++ cloud-init-22.3.3/tests/unittests/sources/test_azure.py 2022-09-19 17:14:49.000000000 +0000 @@ -3999,6 +3999,20 @@ ] +class TestInstanceId: + def test_metadata(self, azure_ds, mock_dmi_read_dmi_data): + azure_ds.metadata = {"instance-id": "test-id"} + + id = azure_ds.get_instance_id() + + assert id == "test-id" + + def test_fallback(self, azure_ds, mock_dmi_read_dmi_data): + id = azure_ds.get_instance_id() + + assert id == "fake-system-uuid" + + class TestProvisioning: @pytest.fixture(autouse=True) def provisioning_setup( diff -Nru cloud-init-22.3-13-g70ce6442/tests/unittests/sources/test_oracle.py cloud-init-22.3.3/tests/unittests/sources/test_oracle.py --- cloud-init-22.3-13-g70ce6442/tests/unittests/sources/test_oracle.py 2022-08-30 19:26:03.000000000 +0000 +++ cloud-init-22.3.3/tests/unittests/sources/test_oracle.py 2022-09-19 17:14:49.000000000 +0000 @@ -299,7 +299,7 @@ assert 1 == len(secondary_nic_cfg["subnets"]) subnet_cfg = secondary_nic_cfg["subnets"][0] # These values are hard-coded in OPC_VM_SECONDARY_VNIC_RESPONSE - assert "10.0.0.231" == subnet_cfg["address"] + assert "10.0.0.231/24" == subnet_cfg["address"] def test_secondary_nic_v2(self, oracle_ds): oracle_ds._vnics_data = json.loads(OPC_VM_SECONDARY_VNIC_RESPONSE) @@ -325,7 +325,7 @@ assert 1 == len(secondary_nic_cfg["addresses"]) # These values are hard-coded in OPC_VM_SECONDARY_VNIC_RESPONSE - assert "10.0.0.231" == secondary_nic_cfg["addresses"][0] + assert "10.0.0.231/24" == secondary_nic_cfg["addresses"][0] @pytest.mark.parametrize("error_add_network", [None, Exception]) @pytest.mark.parametrize( diff -Nru cloud-init-22.3-13-g70ce6442/tests/unittests/test_upgrade.py cloud-init-22.3.3/tests/unittests/test_upgrade.py --- cloud-init-22.3-13-g70ce6442/tests/unittests/test_upgrade.py 2022-08-30 19:26:03.000000000 +0000 +++ cloud-init-22.3.3/tests/unittests/test_upgrade.py 2022-09-19 17:14:49.000000000 +0000 @@ -1,7 +1,5 @@ # Copyright (C) 2020 Canonical Ltd. # -# Author: Daniel Watkins -# # This file is part of cloud-init. See LICENSE file for license information. """Upgrade testing for cloud-init. @@ -19,8 +17,15 @@ import pytest from cloudinit.sources import pkl_load +from cloudinit.sources.DataSourceAzure import DataSourceAzure +from cloudinit.sources.DataSourceNoCloud import DataSourceNoCloud from tests.unittests.helpers import resourceLocation +DSNAME_TO_CLASS = { + "Azure": DataSourceAzure, + "NoCloud": DataSourceNoCloud, +} + class TestUpgrade: @pytest.fixture( @@ -36,6 +41,25 @@ """ return pkl_load(str(request.param)) + def test_pkl_load_defines_all_init_side_effect_attributes( + self, previous_obj_pkl + ): + """Any attrs as side-effects of __init__ exist in unpickled obj.""" + ds_class = DSNAME_TO_CLASS[previous_obj_pkl.dsname] + sys_cfg = previous_obj_pkl.sys_cfg + distro = previous_obj_pkl.distro + paths = previous_obj_pkl.paths + ds = ds_class(sys_cfg, distro, paths) + if ds.dsname == "NoCloud" and previous_obj_pkl.__dict__: + expected = ( + set({"seed_dirs"}), # LP: #1568150 handled with getattr checks + set(), + ) + else: + expected = (set(),) + missing_attrs = ds.__dict__.keys() - previous_obj_pkl.__dict__.keys() + assert missing_attrs in expected + def test_networking_set_on_distro(self, previous_obj_pkl): """We always expect to have ``.networking`` on ``Distro`` objects.""" assert previous_obj_pkl.distro.networking is not None