From a0a68a24c34ee268962e7a3c3844c59ab4036bf9 Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Tue, 19 Oct 2021 02:09:40 +0200 Subject: VMware: read network-config from ISO (#1066) There is no reason for the ISO missing this functionality. As discussed in https://github.com/canonical/cloud-init/pull/947/files#r707338489 --- tests/unittests/test_datasource/test_ovf.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'tests/unittests') diff --git a/tests/unittests/test_datasource/test_ovf.py b/tests/unittests/test_datasource/test_ovf.py index 2ca10781..f5818a3a 100644 --- a/tests/unittests/test_datasource/test_ovf.py +++ b/tests/unittests/test_datasource/test_ovf.py @@ -519,6 +519,12 @@ class TestDatasourceOVF(CiTestCase): ds.subplatform) def test_get_data_vmware_guestinfo_with_network_config(self): + self._test_get_data_with_network_config(guestinfo=False, iso=True) + + def test_get_data_iso9660_with_network_config(self): + self._test_get_data_with_network_config(guestinfo=True, iso=False) + + def _test_get_data_with_network_config(self, guestinfo, iso): network_config = dedent("""\ network: version: 2 @@ -544,9 +550,9 @@ class TestDatasourceOVF(CiTestCase): paths = Paths({'cloud_dir': self.tdir, 'run_dir': self.tdir}) ds = self.datasource(sys_cfg={}, distro={}, paths=paths) with mock.patch(MPATH + 'transport_vmware_guestinfo', - return_value=env): + return_value=env if guestinfo else NOT_FOUND): with mock.patch(MPATH + 'transport_iso9660', - return_value=NOT_FOUND): + return_value=env if iso else NOT_FOUND): self.assertTrue(ds.get_data()) self.assertEqual('inst-001', ds.metadata['instance-id']) self.assertEqual( -- cgit v1.2.3