Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cloudinit/sources/DataSourceOVF.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,7 @@ def _get_data(self):
if contents:
break
if contents:
read_network = ('com.vmware.guestInfo' == name)
(md, ud, cfg) = read_ovf_environment(contents, read_network)
(md, ud, cfg) = read_ovf_environment(contents, True)
self.environment = contents
if 'network-config' in md and md['network-config']:
self._network_config = md['network-config']
Expand Down
2 changes: 1 addition & 1 deletion doc/sources/ovf/example/ovf-env.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<Property oe:key="user-data" oe:value="IyEvYmluL3NoCmVjaG8gImhpIHdvcmxkIgo="/>
<Property oe:key="password" oe:value="passw0rd"/>
<!--
network-config is optional, it can only be read from VMware guestinfo.ovfEnv
network-config is optional.
The value for network-config is to be base64 encoded.
It will be decoded, and then processed normally as network-config.
Set ovf-env.xml to VMware guestinfo.ovfEnv by below command:
Expand Down
10 changes: 8 additions & 2 deletions tests/unittests/test_datasource/test_ovf.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,12 @@ def test_get_data_vmware_seed_platform_info(self):
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
Expand All @@ -544,9 +550,9 @@ def test_get_data_vmware_guestinfo_with_network_config(self):
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(
Expand Down
1 change: 1 addition & 0 deletions tools/.github-cla-signers
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ slyon
smoser
sshedi
stappersg
t-8ch
TheRealFalcon
taoyama
timothegenzmer
Expand Down