summaryrefslogtreecommitdiff
path: root/cloudinit/sources
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2014-02-14 14:24:06 -0500
committerScott Moser <smoser@ubuntu.com>2014-02-14 14:24:06 -0500
commitb812776fcccd780a05cbbdd2d924f615e724bb60 (patch)
tree6e80a19556157f14003f3296843e08808af06d9d /cloudinit/sources
parent08a4c6b7e91134c2b2c56330ece85a17a1061f00 (diff)
downloadvyos-cloud-init-b812776fcccd780a05cbbdd2d924f615e724bb60.tar.gz
vyos-cloud-init-b812776fcccd780a05cbbdd2d924f615e724bb60.zip
DataSourceOpenStack: allow vendor-data to be a dict with 'cloud-init' inside
There might be multiple things to put inside a vendor-data. So, if it is a dict and that dict has 'cloud-init', assume that the whole thing was not meant for cloud-init, and set vendordata_raw to the specific item.
Diffstat (limited to 'cloudinit/sources')
-rw-r--r--cloudinit/sources/DataSourceOpenStack.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/cloudinit/sources/DataSourceOpenStack.py b/cloudinit/sources/DataSourceOpenStack.py
index 5edbb448..72ec8075 100644
--- a/cloudinit/sources/DataSourceOpenStack.py
+++ b/cloudinit/sources/DataSourceOpenStack.py
@@ -142,7 +142,15 @@ class DataSourceOpenStack(openstack.SourceMixin, sources.DataSource):
self.userdata_raw = results.get('userdata')
self.version = results['version']
self.files.update(results.get('files', {}))
- self.vendordata_raw = results.get('vendordata')
+
+ # if vendordata includes 'cloud-init', then read that explicitly
+ # for cloud-init (for namespacing).
+ vd = results.get('vendordata')
+ if isinstance(vd, dict) and 'cloud-init' in vd:
+ self.vendordata_raw = vd['cloud-init']
+ else:
+ self.vendordata_raw = vd
+
return True