diff options
author | Scott Moser <smoser@ubuntu.com> | 2014-09-10 16:12:28 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2014-09-10 16:12:28 -0400 |
commit | 4a03c618b58e4da727992441aa760057e5424379 (patch) | |
tree | 7ff89798777a0ee0418d959db81147853db380c3 /cloudinit/sources/DataSourceConfigDrive.py | |
parent | 67f198ceb6dfeb82b2d3f78955d21d09d43fa7db (diff) | |
parent | 44113217719ebee756325b40a5d14045ba8f3a3a (diff) | |
download | vyos-cloud-init-4a03c618b58e4da727992441aa760057e5424379.tar.gz vyos-cloud-init-4a03c618b58e4da727992441aa760057e5424379.zip |
ConfigDrive: support reading vendor_data similar to OpenStack MD reader
This makes the DataSourceConfigDrive support vendor-data in the same
way the metadata service reader does. There are still some things to
fix here, but now we're similar between these two.
Also drops the ability to specify a version (as in YYYY-MM-DD) that you want to
look for. Nothing was using this, but it may be useful to add back in
in the future and expose as a datasource config option.
Diffstat (limited to 'cloudinit/sources/DataSourceConfigDrive.py')
-rw-r--r-- | cloudinit/sources/DataSourceConfigDrive.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py index 0c35f83a..a27d07fb 100644 --- a/cloudinit/sources/DataSourceConfigDrive.py +++ b/cloudinit/sources/DataSourceConfigDrive.py @@ -125,7 +125,14 @@ 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 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'] + return True @@ -160,10 +167,10 @@ 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): reader = openstack.ConfigDriveReader(source_dir) finders = [ - (reader.read_v2, [], {'version': version}), + (reader.read_v2, [], {}), (reader.read_v1, [], {}), ] excps = [] |