summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceConfigDrive.py
diff options
context:
space:
mode:
authorJay Faulkner <jay@jvf.cc>2014-08-26 12:38:41 -0700
committerJay Faulkner <jay@jvf.cc>2014-08-26 12:38:41 -0700
commit92c04cc87387e244485ad502ecacd46b3f150366 (patch)
treed075f50ef93911edd1b6673225aeea59a9570baa /cloudinit/sources/DataSourceConfigDrive.py
parent2e6aa38e0986ee67f5e93cd6bb7b32c52f8207e6 (diff)
downloadvyos-cloud-init-92c04cc87387e244485ad502ecacd46b3f150366.tar.gz
vyos-cloud-init-92c04cc87387e244485ad502ecacd46b3f150366.zip
Upgrade configdrive version
- Upgrade configdrive to use 2013-10-17 - Fix issue with vendor_data.json parsing Co-Authored-By: Paul Querna <pquerna@apache.org>
Diffstat (limited to 'cloudinit/sources/DataSourceConfigDrive.py')
-rw-r--r--cloudinit/sources/DataSourceConfigDrive.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py
index 0c35f83a..8e65fc46 100644
--- a/cloudinit/sources/DataSourceConfigDrive.py
+++ b/cloudinit/sources/DataSourceConfigDrive.py
@@ -125,7 +125,19 @@ class DataSourceConfigDrive(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):
+ if 'cloud-init' in vd:
+ self.vendordata_raw = vd['cloud-init']
+ else:
+ # TODO(pquerna): this is so wrong.
+ self.vendordata_raw = json.dumps(vd)
+ else:
+ self.vendordata_raw = vd
+
return True
@@ -160,7 +172,7 @@ def get_ds_mode(cfgdrv_ver, ds_cfg=None, user=None):
return "net"
-def read_config_drive(source_dir, version="2012-08-10"):
+def read_config_drive(source_dir, version="2013-10-17"):
reader = openstack.ConfigDriveReader(source_dir)
finders = [
(reader.read_v2, [], {'version': version}),