From aae54b5e8e1aee908b01050aa6c9c821fe94195e Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Fri, 31 Aug 2012 17:01:51 -0700 Subject: Don't look into cloud-archive (after processing) for launch indexes (since they will be handled beforehand) and fix the types being checked on the root of the archive format to be a tuple instead of a list (which oddly causes complaints). --- cloudinit/user_data.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cloudinit') diff --git a/cloudinit/user_data.py b/cloudinit/user_data.py index 5d550e1d..f9f84030 100644 --- a/cloudinit/user_data.py +++ b/cloudinit/user_data.py @@ -54,7 +54,7 @@ ATTACHMENT_FIELD = 'Number-Attachments' # Only the following content types can have there launch index examined # in there payload, evey other content type can still provide a header -EXAMINE_FOR_LAUNCH_INDEX = ["text/cloud-config", "text/cloud-config-archive"] +EXAMINE_FOR_LAUNCH_INDEX = ["text/cloud-config"] class UserDataProcessor(object): @@ -180,7 +180,7 @@ class UserDataProcessor(object): self._process_msg(new_msg, append_msg) def _explode_archive(self, archive, append_msg): - entries = util.load_yaml(archive, default=[], allowed=[list, set]) + entries = util.load_yaml(archive, default=[], allowed=(list, set)) for ent in entries: # ent can be one of: # dict { 'filename' : 'value', 'content' : -- cgit v1.2.3 From ec911fd083db63521aa425203fb30dd6fc7302d5 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Fri, 31 Aug 2012 18:12:30 -0700 Subject: 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). --- cloudinit/user_data.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cloudinit') 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: -- cgit v1.2.3