summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2013-07-09 15:49:55 -0400
committerScott Moser <smoser@ubuntu.com>2013-07-09 15:49:55 -0400
commitc12845193066ac2eb14b9bbef75657d579b696b5 (patch)
tree7e9dc7e157643f2fd6712be145eb5a63be7139ed
parentcf1b10900626dfa6194c77b6720291e7edbaf9f6 (diff)
downloadvyos-cloud-init-c12845193066ac2eb14b9bbef75657d579b696b5.tar.gz
vyos-cloud-init-c12845193066ac2eb14b9bbef75657d579b696b5.zip
search in the default storage directory for cached ovf-env.xml
since azure ejects the disk on reboot, we need to look there to find this datasource.
-rw-r--r--cloudinit/sources/DataSourceAzure.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index f1c7c771..92b6172b 100644
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -47,8 +47,19 @@ class DataSourceAzureNet(sources.DataSource):
return "%s [seed=%s]" % (root, self.seed)
def get_data(self):
+ ddir_cfgpath = ['datasource', DS_NAME, 'data_dir']
+ # azure removes/ejects the cdrom containing the ovf-env.xml
+ # file on reboot. So, in order to successfully reboot we
+ # need to look in the datadir and consider that valid
+ ddir = util.get_cfg_by_path(self.sys_cfg, ddir_cfgpath)
+ if ddir is None:
+ ddir = util.get_cfg_by_path(BUILTIN_DS_CONFIG, ddir_cfgpath)
+
candidates = [self.seed_dir]
candidates.extend(list_possible_azure_ds_devs())
+ if ddir:
+ candidates.append(ddir)
+
found = None
for cdev in candidates:
@@ -79,7 +90,7 @@ class DataSourceAzureNet(sources.DataSource):
return False
fields = [('cmd', ['datasource', DS_NAME, 'agent_command']),
- ('datadir', ['datasource', DS_NAME, 'data_dir'])]
+ ('datadir', ddir_cfgpath)]
mycfg = {}
for cfg in (self.cfg, self.sys_cfg, BUILTIN_DS_CONFIG):
for name, path in fields: