summaryrefslogtreecommitdiff
path: root/cloudinit/handlers
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2012-11-22 08:24:25 -0800
committerJoshua Harlow <harlowja@gmail.com>2012-11-22 08:24:25 -0800
commit0596e8db112a031095e8f5cbdae770e8f3ca4bbb (patch)
tree550b2fdb14bc0c768d1d4fd6b7740227be85e4a1 /cloudinit/handlers
parenteded09c1e260330107a19bd0b5a351686fe49e80 (diff)
downloadvyos-cloud-init-0596e8db112a031095e8f5cbdae770e8f3ca4bbb.tar.gz
vyos-cloud-init-0596e8db112a031095e8f5cbdae770e8f3ca4bbb.zip
Select merge-type from either header or content after loading as yaml.
Diffstat (limited to 'cloudinit/handlers')
-rw-r--r--cloudinit/handlers/cloud_config.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/cloudinit/handlers/cloud_config.py b/cloudinit/handlers/cloud_config.py
index 22ced20d..ba07b2ef 100644
--- a/cloudinit/handlers/cloud_config.py
+++ b/cloudinit/handlers/cloud_config.py
@@ -50,11 +50,13 @@ class CloudConfigPartHandler(handlers.Handler):
util.write_file(self.cloud_fn, "\n".join(lines), 0600)
def _merge_part(self, payload, headers, filename):
- merge_how = headers.get("Merge-Type")
+ merge_headers_how = headers.get("Merge-Type")
try:
payload_y = util.load_yaml(payload)
- if not merge_how:
- merge_how = payload_y.pop("Merge-Type", '')
+ merge_how = ''
+ for merge_i in [payload_y.pop("Merge-Type", ''), merge_headers_how]:
+ if merge_i:
+ merge_how = merge_i
merge_how = merge_how.strip().lower()
if not merge_how:
merge_how = DEF_MERGE_TYPE