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.
This commit is contained in:
parent
6fd22099e2
commit
539d1733ac
@ -142,7 +142,15 @@ class DataSourceOpenStack(openstack.SourceMixin, sources.DataSource):
|
|||||||
self.userdata_raw = results.get('userdata')
|
self.userdata_raw = results.get('userdata')
|
||||||
self.version = results['version']
|
self.version = results['version']
|
||||||
self.files.update(results.get('files', {}))
|
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
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user