diff options
author | xiaofengw-vmware <42736879+xiaofengw-vmware@users.noreply.github.com> | 2021-01-14 07:18:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-13 16:18:28 -0700 |
commit | 11630044d235e0c6e1ffd2b12ff8906613ccdac6 (patch) | |
tree | 1fe9dabec46dc68778e557b301be4679a56964b7 /tests/unittests/test_vmware_config_file.py | |
parent | 9a258eebd96aa5ad4486dba1fe86bea5bcf00c2f (diff) | |
download | vyos-cloud-init-11630044d235e0c6e1ffd2b12ff8906613ccdac6.tar.gz vyos-cloud-init-11630044d235e0c6e1ffd2b12ff8906613ccdac6.zip |
[VMware] Support cloudinit raw data feature (#691)
This feature will modify VMware datasource to read from meta data and user data which are specified by VMware vSphere user. If meta data/user data are found in cloud-init configuration directory, datasource will parse the meta data/network and user data from the configuration file, otherwise it will continue to parse them from traditional customization configuration file as before. The supported meta data file is in json or yaml format.
Diffstat (limited to 'tests/unittests/test_vmware_config_file.py')
-rw-r--r-- | tests/unittests/test_vmware_config_file.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/unittests/test_vmware_config_file.py b/tests/unittests/test_vmware_config_file.py index 9c7d25fa..430cc69f 100644 --- a/tests/unittests/test_vmware_config_file.py +++ b/tests/unittests/test_vmware_config_file.py @@ -525,5 +525,21 @@ class TestVmwareNetConfig(CiTestCase): 'gateway': '10.20.87.253'}]}], nc.generate()) + def test_meta_data(self): + cf = ConfigFile("tests/data/vmware/cust-dhcp-2nic.cfg") + conf = Config(cf) + self.assertIsNone(conf.meta_data_name) + cf._insertKey("CLOUDINIT|METADATA", "test-metadata") + conf = Config(cf) + self.assertEqual("test-metadata", conf.meta_data_name) + + def test_user_data(self): + cf = ConfigFile("tests/data/vmware/cust-dhcp-2nic.cfg") + conf = Config(cf) + self.assertIsNone(conf.user_data_name) + cf._insertKey("CLOUDINIT|USERDATA", "test-userdata") + conf = Config(cf) + self.assertEqual("test-userdata", conf.user_data_name) + # vi: ts=4 expandtab |