summaryrefslogtreecommitdiff
path: root/tests/unittests/test_datasource/test_azure.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2013-07-09 15:07:38 -0400
committerScott Moser <smoser@ubuntu.com>2013-07-09 15:07:38 -0400
commitcf1b10900626dfa6194c77b6720291e7edbaf9f6 (patch)
tree25f6155e80a7545ddea75af1b0c40fbe9785521e /tests/unittests/test_datasource/test_azure.py
parent6bea1cb867c13e05e3548c648d5f051d2c49f07b (diff)
downloadvyos-cloud-init-cf1b10900626dfa6194c77b6720291e7edbaf9f6.tar.gz
vyos-cloud-init-cf1b10900626dfa6194c77b6720291e7edbaf9f6.zip
populate /var/lib/waagent with ovf-env.xml
this will copy the ovf-env.xml file that was found to the configured directory (default /var/lib/waagent)
Diffstat (limited to 'tests/unittests/test_datasource/test_azure.py')
-rw-r--r--tests/unittests/test_datasource/test_azure.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py
index a2347f1b..68f4bcca 100644
--- a/tests/unittests/test_datasource/test_azure.py
+++ b/tests/unittests/test_datasource/test_azure.py
@@ -83,6 +83,12 @@ class TestAzureDataSource(MockerTestCase):
def invoker(cmd):
data['agent_invoked'] = cmd
+ def file_writer(datadir, files):
+ data['files'] = {}
+ data['datadir'] = datadir
+ for (fname, content) in files.items():
+ data['files'][fname] = content
+
if data.get('ovfcontent') is not None:
populate_dir(os.path.join(self.paths.seed_dir, "azure"),
{'ovf-env.xml': data['ovfcontent']})
@@ -93,6 +99,7 @@ class TestAzureDataSource(MockerTestCase):
self.apply_patches([(mod, 'list_possible_azure_ds_devs', dsdevs)])
self.apply_patches([(mod, 'invoke_agent', invoker)])
+ self.apply_patches([(mod, 'write_files', file_writer)])
dsrc = mod.DataSourceAzureNet(
data.get('sys_cfg', {}), distro=None, paths=self.paths)
@@ -109,6 +116,7 @@ class TestAzureDataSource(MockerTestCase):
self.assertTrue(ret)
self.assertEqual(dsrc.userdata_raw, "")
self.assertEqual(dsrc.metadata['local-hostname'], odata['HostName'])
+ self.assertTrue('ovf-env.xml' in data['files'])
def test_user_cfg_set_agent_command(self):
cfg = {'agent_command': "my_command"}