summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceOpenStack.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2014-09-12 15:46:00 -0400
committerScott Moser <smoser@ubuntu.com>2014-09-12 15:46:00 -0400
commit3ac51517c6e561a4c3590af972b95602aa496afd (patch)
tree797e98be2637f9523defa2e08c01ff5a1d39a19f /cloudinit/sources/DataSourceOpenStack.py
parent26c1cf9eeeb39e9bfcc1a37743679e5c76ab97b0 (diff)
parenta515846e2cf59568d402baee70950a0b1b1d3182 (diff)
downloadvyos-cloud-init-3ac51517c6e561a4c3590af972b95602aa496afd.tar.gz
vyos-cloud-init-3ac51517c6e561a4c3590af972b95602aa496afd.zip
OpenStack: fix consumption of vendor-data to allow namespacing
Not all vendor data is destined for cloud-init. This sanely reads the vendor data as a dict, array or a string.
Diffstat (limited to 'cloudinit/sources/DataSourceOpenStack.py')
-rw-r--r--cloudinit/sources/DataSourceOpenStack.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/cloudinit/sources/DataSourceOpenStack.py b/cloudinit/sources/DataSourceOpenStack.py
index 765137c6..469c2e2a 100644
--- a/cloudinit/sources/DataSourceOpenStack.py
+++ b/cloudinit/sources/DataSourceOpenStack.py
@@ -140,13 +140,13 @@ class DataSourceOpenStack(openstack.SourceMixin, sources.DataSource):
self.version = results['version']
self.files.update(results.get('files', {}))
- # 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
+ self.vendordata_pure = vd
+ try:
+ self.vendordata_raw = openstack.convert_vendordata_json(vd)
+ except ValueError as e:
+ LOG.warn("Invalid content in vendor-data: %s", e)
+ self.vendordata_raw = None
return True