summaryrefslogtreecommitdiff
path: root/cloudinit/sources
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-03-16 21:06:28 -0400
committerScott Moser <smoser@ubuntu.com>2016-03-16 21:06:28 -0400
commit1dd9102afda920d486a144b3153d6c9951f45cf9 (patch)
tree5bac4499a2d8ccd8fea3763bb9939c902f20a7b7 /cloudinit/sources
parent14c88d8c28a044776d011ed507f8f6465ec3e2c7 (diff)
downloadvyos-cloud-init-1dd9102afda920d486a144b3153d6c9951f45cf9.tar.gz
vyos-cloud-init-1dd9102afda920d486a144b3153d6c9951f45cf9.zip
fix regression when command line (ds=nocloud) is present
parsing the command line parameters returned a dictionary but _merge_new_seed was expecting a string to be yaml loaded. Change is to make _merge_new_seed take either string or dict.
Diffstat (limited to 'cloudinit/sources')
-rw-r--r--cloudinit/sources/DataSourceNoCloud.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/cloudinit/sources/DataSourceNoCloud.py b/cloudinit/sources/DataSourceNoCloud.py
index a3532463..64853385 100644
--- a/cloudinit/sources/DataSourceNoCloud.py
+++ b/cloudinit/sources/DataSourceNoCloud.py
@@ -58,7 +58,7 @@ class DataSourceNoCloud(sources.DataSource):
md = {}
if parse_cmdline_data(self.cmdline_id, md):
found.append("cmdline")
- mydata = _merge_new_seed({'meta-data': md})
+ mydata = _merge_new_seed(mydata, {'meta-data': md})
except:
util.logexc(LOG, "Unable to parse command line data")
return False
@@ -256,8 +256,12 @@ def parse_cmdline_data(ds_id, fill, cmdline=None):
def _merge_new_seed(cur, seeded):
ret = cur.copy()
- ret['meta-data'] = util.mergemanydict([cur['meta-data'],
- util.load_yaml(seeded['meta-data'])])
+
+ newmd = seeded.get('meta-data', {})
+ if not isinstance(seeded['meta-data'], dict):
+ newmd = util.load_yaml(seeded['meta-data'])
+ ret['meta-data'] = util.mergemanydict([cur['meta-data'], newmd])
+
if seeded.get('network-config'):
ret['network-config'] = util.load_yaml(seeded['network-config'])