From b812776fcccd780a05cbbdd2d924f615e724bb60 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 14 Feb 2014 14:24:06 -0500 Subject: 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. --- cloudinit/sources/DataSourceOpenStack.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cloudinit/sources') 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 -- cgit v1.2.3