Skip to content

Commit b812776

Browse files
committed
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.
1 parent 08a4c6b commit b812776

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cloudinit/sources/DataSourceOpenStack.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,15 @@ def get_data(self):
142142
self.userdata_raw = results.get('userdata')
143143
self.version = results['version']
144144
self.files.update(results.get('files', {}))
145-
self.vendordata_raw = results.get('vendordata')
145+
146+
# if vendordata includes 'cloud-init', then read that explicitly
147+
# for cloud-init (for namespacing).
148+
vd = results.get('vendordata')
149+
if isinstance(vd, dict) and 'cloud-init' in vd:
150+
self.vendordata_raw = vd['cloud-init']
151+
else:
152+
self.vendordata_raw = vd
153+
146154
return True
147155

148156

0 commit comments

Comments
 (0)