summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-08-31 18:12:30 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-08-31 18:12:30 -0700
commitec911fd083db63521aa425203fb30dd6fc7302d5 (patch)
treeec5fe8bd82785abcf4cd9bee2a041915edfe487b
parentaae54b5e8e1aee908b01050aa6c9c821fe94195e (diff)
downloadvyos-cloud-init-ec911fd083db63521aa425203fb30dd6fc7302d5.tar.gz
vyos-cloud-init-ec911fd083db63521aa425203fb30dd6fc7302d5.zip
When a parts content type is found to be different than
its original content type said it is, make sure we set the new value, also unsure if the old top level message should have the same header (which will flip-flop).
-rw-r--r--cloudinit/user_data.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/cloudinit/user_data.py b/cloudinit/user_data.py
index f9f84030..803ffc3a 100644
--- a/cloudinit/user_data.py
+++ b/cloudinit/user_data.py
@@ -84,6 +84,12 @@ class UserDataProcessor(object):
if ctype is None:
ctype = ctype_orig
+ if ctype != ctype_orig:
+ if CONTENT_TYPE in part:
+ part.replace_header(CONTENT_TYPE, ctype)
+ else:
+ part[CONTENT_TYPE] = ctype
+
if ctype in INCLUDE_TYPES:
self._do_include(payload, append_msg)
continue
@@ -92,6 +98,8 @@ class UserDataProcessor(object):
self._explode_archive(payload, append_msg)
continue
+ # Should this be happening, shouldn't
+ # the part header be modified and not the base?
if CONTENT_TYPE in base_msg:
base_msg.replace_header(CONTENT_TYPE, ctype)
else: