diff options
author | Scott Moser <smoser@ubuntu.com> | 2014-09-10 21:17:40 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2014-09-10 21:17:40 -0400 |
commit | 932c073db79e667623d27174c55e5b16ea439578 (patch) | |
tree | 14469c0eff9bb76c038f4c7f58cc31e752e8a2eb /cloudinit/sources/DataSourceConfigDrive.py | |
parent | 2755274f34ef11651a5ee57a31955f3e413cdfc4 (diff) | |
download | vyos-cloud-init-932c073db79e667623d27174c55e5b16ea439578.tar.gz vyos-cloud-init-932c073db79e667623d27174c55e5b16ea439578.zip |
Openstack: Vendor data cleanup
For now, this vendor data handling is just added to openstack.
However, in an effort to allow sanely handling of multi-part vendor-data
that is namespaced, we add openstack.convert_vendordata_json .
That basically takes whatever was loaded from vendordata and takes
the 'cloud-init' key if it is a dict. This way the author can
namespace cloud-init, basically telling it to ignore everything else.
Diffstat (limited to 'cloudinit/sources/DataSourceConfigDrive.py')
-rw-r--r-- | cloudinit/sources/DataSourceConfigDrive.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py index a27d07fb..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 |