summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2013-07-11 10:16:18 -0400
committerScott Moser <smoser@ubuntu.com>2013-07-11 10:16:18 -0400
commit8c15320283012d218c2165f5dfb38a29d2cf7b53 (patch)
tree3995802ea04a4af71c4e061355b4c0214d2c76c2
parent299af1d4a3e09ad9c961cb641e62a20ab5998640 (diff)
downloadvyos-cloud-init-8c15320283012d218c2165f5dfb38a29d2cf7b53.tar.gz
vyos-cloud-init-8c15320283012d218c2165f5dfb38a29d2cf7b53.zip
DataSourceAzure.py: allow 'customdata' to be the name for userdata
Also, fix a comment and write a log message on how long we waited for the files to appear.
-rw-r--r--cloudinit/sources/DataSourceAzure.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index 200bede5..2818408c 100644
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -119,9 +119,13 @@ class DataSourceAzureNet(sources.DataSource):
bname = pk['fingerprint'] + ".crt"
fp_files += [os.path.join(mycfg['datadir'], bname)]
+ start = time.time()
missing = wait_for_files(wait_for + fp_files)
if len(missing):
- LOG.warn("Did not find files, but going on: %s" % missing)
+ LOG.warn("Did not find files, but going on: %s", missing)
+ else:
+ LOG.debug("waited %.3f seconds for %d files to appear",
+ time.time() - start, len(wait_for))
pubkeys = pubkeys_from_crt_files(fp_files)
@@ -197,7 +201,8 @@ def find_child(node, filter_func):
def load_azure_ovf_pubkeys(sshnode):
- # in the future this would return a list of dicts like:
+ # This parses a 'SSH' node formatted like below, and returns
+ # an array of dicts.
# [{'fp': '6BE7A7C3C8A8F4B123CCA5D0C2F1BE4CA7B63ED7',
# 'path': 'where/to/go'}]
#
@@ -293,7 +298,9 @@ def read_azure_ovf(contents):
simple = True
value = child.childNodes[0].wholeText
- if name == "userdata":
+ # we accept either UserData or CustomData. If both are present
+ # then behavior is undefined.
+ if (name == "userdata" or name == "customdata"):
ud = base64.b64decode(''.join(value.split()))
elif name == "username":
username = value