diff options
Diffstat (limited to 'cloudinit/sources/DataSourceConfigDrive.py')
-rw-r--r-- | cloudinit/sources/DataSourceConfigDrive.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py index c55f7d4a..65477184 100644 --- a/cloudinit/sources/DataSourceConfigDrive.py +++ b/cloudinit/sources/DataSourceConfigDrive.py @@ -126,15 +126,12 @@ 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). - 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) + if 'cloud-init' in vd: + self.vendordata_raw = vd['cloud-init'] else: self.vendordata_raw = vd |