diff options
-rw-r--r-- | cloudinit/stages.py | 18 | ||||
-rw-r--r-- | tools/.github-cla-signers | 1 |
2 files changed, 15 insertions, 4 deletions
diff --git a/cloudinit/stages.py b/cloudinit/stages.py index 3ef4491c..5bacc85d 100644 --- a/cloudinit/stages.py +++ b/cloudinit/stages.py @@ -364,12 +364,12 @@ class Init(object): 'userdata') self._store_processeddata(self.datasource.get_userdata(), 'userdata') - self._store_rawdata(self.datasource.get_vendordata_raw(), - 'vendordata') + self._store_raw_vendordata(self.datasource.get_vendordata_raw(), + 'vendordata') self._store_processeddata(self.datasource.get_vendordata(), 'vendordata') - self._store_rawdata(self.datasource.get_vendordata2_raw(), - 'vendordata2') + self._store_raw_vendordata(self.datasource.get_vendordata2_raw(), + 'vendordata2') self._store_processeddata(self.datasource.get_vendordata2(), 'vendordata2') @@ -397,6 +397,16 @@ class Init(object): data = b'' util.write_file(self._get_ipath('%s_raw' % datasource), data, 0o600) + def _store_raw_vendordata(self, data, datasource): + # Only these data types + if data is not None and type(data) not in [bytes, str, list]: + raise TypeError("vendordata_raw is unsupported type '%s'" % + str(type(data))) + # This data may be a list, convert it to a string if so + if isinstance(data, list): + data = util.json_dumps(data) + self._store_rawdata(data, datasource) + def _store_processeddata(self, processed_data, datasource): # processed is a Mime message, so write as string. if processed_data is None: diff --git a/tools/.github-cla-signers b/tools/.github-cla-signers index aca0ee5e..5c57acac 100644 --- a/tools/.github-cla-signers +++ b/tools/.github-cla-signers @@ -14,6 +14,7 @@ dankenigsberg dermotbradley dhensby eandersson +eb3095 emmanuelthome izzyleung johnsonshi |