summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceConfigDrive.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2014-09-15 20:13:07 -0400
committerScott Moser <smoser@ubuntu.com>2014-09-15 20:13:07 -0400
commitbea35b7685978804557aada44c819c536ab209b3 (patch)
tree070fb6db5efec8e0cd2e5d1d51d4c7f5e748085e /cloudinit/sources/DataSourceConfigDrive.py
parent668919511625f7b6a8922e4504e224e915f7be22 (diff)
parent6093b8b2733814b9265494c47f4268167c9491ab (diff)
downloadvyos-cloud-init-bea35b7685978804557aada44c819c536ab209b3.tar.gz
vyos-cloud-init-bea35b7685978804557aada44c819c536ab209b3.zip
merge from trunk
Diffstat (limited to 'cloudinit/sources/DataSourceConfigDrive.py')
-rw-r--r--cloudinit/sources/DataSourceConfigDrive.py27
1 files changed, 12 insertions, 15 deletions
diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py
index 83cc6b25..4e5d90de 100644
--- a/cloudinit/sources/DataSourceConfigDrive.py
+++ b/cloudinit/sources/DataSourceConfigDrive.py
@@ -126,12 +126,13 @@ class DataSourceConfigDrive(openstack.SourceMixin, sources.DataSource):
self.version = results['version']
self.files.update(results.get('files', {}))
- # If there is no vendordata, set vd to an empty dict instead of None
- vd = results.get('vendordata', {})
- # if vendordata includes 'cloud-init', then read that explicitly
- # for cloud-init (for namespacing).
- if 'cloud-init' in vd:
- self.vendordata_raw = vd['cloud-init']
+ vd = results.get('vendordata')
+ 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
@@ -168,16 +169,12 @@ def get_ds_mode(cfgdrv_ver, ds_cfg=None, user=None):
def read_config_drive(source_dir):
- excps = []
- finders = []
reader = openstack.ConfigDriveReader(source_dir)
-
- # openstack.OS_VERSIONS is stored in chronological order, so to check the
- # newest first, use reversed()
- for version in reversed(openstack.OS_VERSIONS):
- finders.append((reader.read_v2, [], {'version': version}))
- finders.append((reader.read_v1, [], {}))
-
+ finders = [
+ (reader.read_v2, [], {}),
+ (reader.read_v1, [], {}),
+ ]
+ excps = []
for (functor, args, kwargs) in finders:
try:
return functor(*args, **kwargs)