summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2022-08-23 14:30:10 -0600
committergit-ubuntu importer <ubuntu-devel-discuss@lists.ubuntu.com>2022-08-23 20:55:10 +0000
commit611f032b07fa6fdd0e59b165a12d02201e61ba35 (patch)
tree57cdadc94b88c59cdd41d33b5a8d8bfef6c95dc5
parent9ee102d8a1e0c48fa7fdd9f468a12f25b60ebd22 (diff)
downloadcloud-init-git-611f032b07fa6fdd0e59b165a12d02201e61ba35.tar.gz
22.3-3-g9f0efc47-0ubuntu1~22.10.1 (patches unapplied)
Imported using git-ubuntu import.
-rw-r--r--cloudinit/sources/DataSourceVMware.py7
-rw-r--r--debian/changelog12
-rw-r--r--packages/redhat/cloud-init.spec.in2
-rw-r--r--packages/suse/cloud-init.spec.in2
-rw-r--r--tests/unittests/config/test_cc_yum_add_repo.py1
-rw-r--r--tests/unittests/sources/test_vmware.py74
6 files changed, 96 insertions, 2 deletions
diff --git a/cloudinit/sources/DataSourceVMware.py b/cloudinit/sources/DataSourceVMware.py
index 80a01e89..308e02e8 100644
--- a/cloudinit/sources/DataSourceVMware.py
+++ b/cloudinit/sources/DataSourceVMware.py
@@ -800,7 +800,7 @@ def wait_on_network(metadata):
wait_on_ipv6 = util.translate_bool(wait_on_ipv6_val)
# Get information about the host.
- host_info = None
+ host_info, ipv4_ready, ipv6_ready = None, False, False
while host_info is None:
# This loop + sleep results in two logs every second while waiting
# for either ipv4 or ipv6 up. Do we really need to log each iteration
@@ -845,7 +845,10 @@ def main():
except Exception:
pass
metadata = {
- "wait-on-network": {"ipv4": True, "ipv6": "false"},
+ WAIT_ON_NETWORK: {
+ WAIT_ON_NETWORK_IPV4: True,
+ WAIT_ON_NETWORK_IPV6: False,
+ },
"network": {"config": {"dhcp": True}},
}
host_info = wait_on_network(metadata)
diff --git a/debian/changelog b/debian/changelog
index b876774f..37334586 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+cloud-init (22.3-3-g9f0efc47-0ubuntu1~22.10.1) kinetic; urgency=medium
+
+ * New upstream snapshot.
+ + DataSourceVMware: fix var use before init (#1674) (LP: #1987005)
+ [Andrew Kutz]
+ + 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)
+ + typo correction in Changelog
+
+ -- Chad Smith <chad.smith@canonical.com> Tue, 23 Aug 2022 14:30:10 -0600
+
cloud-init (22.3-0ubuntu1~22.10.1) kinetic; urgency=medium
* New upstream release.
diff --git a/packages/redhat/cloud-init.spec.in b/packages/redhat/cloud-init.spec.in
index 0ea782b9..5cbf828a 100644
--- a/packages/redhat/cloud-init.spec.in
+++ b/packages/redhat/cloud-init.spec.in
@@ -192,6 +192,8 @@ fi
# Configs
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg
+%dir %{_sysconfdir}/cloud/clean.d
+%config(noreplace) %{_sysconfdir}/cloud/clean.d/README
%dir %{_sysconfdir}/cloud/cloud.cfg.d
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/*.cfg
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/README
diff --git a/packages/suse/cloud-init.spec.in b/packages/suse/cloud-init.spec.in
index da8107b4..2586f248 100644
--- a/packages/suse/cloud-init.spec.in
+++ b/packages/suse/cloud-init.spec.in
@@ -114,6 +114,8 @@ version_pys=$(cd "%{buildroot}" && find . -name version.py -type f)
%doc %{_defaultdocdir}/cloud-init/*
# Configs
+%dir %{_sysconfdir}/cloud/clean.d
+%config(noreplace) %{_sysconfdir}/cloud/clean.d/README
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg
%dir %{_sysconfdir}/cloud/cloud.cfg.d
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/*.cfg
diff --git a/tests/unittests/config/test_cc_yum_add_repo.py b/tests/unittests/config/test_cc_yum_add_repo.py
index d821d40a..6edd21f4 100644
--- a/tests/unittests/config/test_cc_yum_add_repo.py
+++ b/tests/unittests/config/test_cc_yum_add_repo.py
@@ -60,6 +60,7 @@ class TestConfig(helpers.FilesystemMockingTestCase):
},
}
self.patchUtils(self.tmp)
+ self.patchOS(self.tmp)
cc_yum_add_repo.handle("yum_add_repo", cfg, None, LOG, [])
contents = util.load_file("/etc/yum.repos.d/epel-testing.repo")
parser = configparser.ConfigParser()
diff --git a/tests/unittests/sources/test_vmware.py b/tests/unittests/sources/test_vmware.py
index 37a1f259..b3663b0a 100644
--- a/tests/unittests/sources/test_vmware.py
+++ b/tests/unittests/sources/test_vmware.py
@@ -87,6 +87,8 @@ class TestDataSourceVMware(CiTestCase):
Test common functionality that is not transport specific.
"""
+ with_logs = True
+
def setUp(self):
super(TestDataSourceVMware, self).setUp()
self.tmp = self.tmp_dir()
@@ -141,6 +143,78 @@ class TestDataSourceVMware(CiTestCase):
host_info[DataSourceVMware.LOCAL_IPV6] == "2001:db8::::::8888"
)
+ @mock.patch("cloudinit.sources.DataSourceVMware.get_host_info")
+ def test_wait_on_network(self, m_fn):
+ metadata = {
+ DataSourceVMware.WAIT_ON_NETWORK: {
+ DataSourceVMware.WAIT_ON_NETWORK_IPV4: True,
+ DataSourceVMware.WAIT_ON_NETWORK_IPV6: False,
+ },
+ }
+ m_fn.side_effect = [
+ {
+ "hostname": "host.cloudinit.test",
+ "local-hostname": "host.cloudinit.test",
+ "local_hostname": "host.cloudinit.test",
+ "network": {
+ "interfaces": {
+ "by-ipv4": {},
+ "by-ipv6": {},
+ "by-mac": {
+ "aa:bb:cc:dd:ee:ff": {"ipv4": [], "ipv6": []}
+ },
+ },
+ },
+ },
+ {
+ "hostname": "host.cloudinit.test",
+ "local-hostname": "host.cloudinit.test",
+ "local-ipv4": "10.10.10.1",
+ "local_hostname": "host.cloudinit.test",
+ "network": {
+ "interfaces": {
+ "by-ipv4": {
+ "10.10.10.1": {
+ "mac": "aa:bb:cc:dd:ee:ff",
+ "netmask": "255.255.255.0",
+ }
+ },
+ "by-mac": {
+ "aa:bb:cc:dd:ee:ff": {
+ "ipv4": [
+ {
+ "addr": "10.10.10.1",
+ "broadcast": "10.10.10.255",
+ "netmask": "255.255.255.0",
+ }
+ ],
+ "ipv6": [],
+ }
+ },
+ },
+ },
+ },
+ ]
+
+ host_info = DataSourceVMware.wait_on_network(metadata)
+
+ logs = self.logs.getvalue()
+ expected_logs = [
+ "DEBUG: waiting on network: wait4=True, "
+ + "ready4=False, wait6=False, ready6=False\n",
+ "DEBUG: waiting on network complete\n",
+ ]
+ for log in expected_logs:
+ self.assertIn(log, logs)
+
+ self.assertTrue(host_info)
+ self.assertTrue(host_info["hostname"])
+ self.assertTrue(host_info["hostname"] == "host.cloudinit.test")
+ self.assertTrue(host_info["local-hostname"])
+ self.assertTrue(host_info["local_hostname"])
+ self.assertTrue(host_info[DataSourceVMware.LOCAL_IPV4])
+ self.assertTrue(host_info[DataSourceVMware.LOCAL_IPV4] == "10.10.10.1")
+
class TestDataSourceVMwareEnvVars(FilesystemMockingTestCase):
"""