Skip to content

Commit

Permalink
Convert arrays and dicts to strings
Browse files Browse the repository at this point in the history
Refactor to request

Syntax error

Syntax error

Syntax error
  • Loading branch information
Eric Benner committed Mar 10, 2021
1 parent 9bd1964 commit 3f1b045
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 10 additions & 4 deletions cloudinit/stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,12 @@ def update(self):
'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')

Expand Down Expand Up @@ -397,6 +397,12 @@ def _store_rawdata(self, data, datasource):
data = b''
util.write_file(self._get_ipath('%s_raw' % datasource), data, 0o600)

def _store_raw_vendordata(self, data, datasource):
# This data may be a list or dict, convert it to a string if so
if type(data) is 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:
Expand Down
1 change: 1 addition & 0 deletions tools/.github-cla-signers
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dankenigsberg
dermotbradley
dhensby
eandersson
eb3095
emmanuelthome
izzyleung
johnsonshi
Expand Down

0 comments on commit 3f1b045

Please sign in to comment.