summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-09-01 20:00:34 -0400
committerScott Moser <smoser@ubuntu.com>2012-09-01 20:00:34 -0400
commit3a35daa68ca7e6214be3f9c1e33a1cdde5f60eb4 (patch)
tree6ffb19dd525035cba407bdd8354a6832b78718e2 /cloudinit
parent47a643296f6656bfda1ea13b5bc98dd4b60d7852 (diff)
parenta7bd5c448a6eda8b3d841f2dd5c73ed3956fe3c3 (diff)
downloadvyos-cloud-init-3a35daa68ca7e6214be3f9c1e33a1cdde5f60eb4.tar.gz
vyos-cloud-init-3a35daa68ca7e6214be3f9c1e33a1cdde5f60eb4.zip
improvements for launch index, one fix for cloud-archive
1. Docs for launch-index + examples 2. Tests for launch-index + data files 3. Fixing a bug with cloud-archive yaml types allowed (likes a tuple not a list for some reason) (LP: #1044594) 4. Setting the 'part' content-type if what we actually use is different. LP: #1044594
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/filters/launch_index.py2
-rw-r--r--cloudinit/user_data.py12
2 files changed, 11 insertions, 3 deletions
diff --git a/cloudinit/filters/launch_index.py b/cloudinit/filters/launch_index.py
index 4299fb46..5bebd318 100644
--- a/cloudinit/filters/launch_index.py
+++ b/cloudinit/filters/launch_index.py
@@ -44,7 +44,7 @@ class Filter(object):
return True
def _do_filter(self, message):
- # Don't use walk() here since we want to do the reforming of the
+ # Don't use walk() here since we want to do the reforming of the
# messages ourselves and not flatten the message listings...
if not self._select(message):
return None
diff --git a/cloudinit/user_data.py b/cloudinit/user_data.py
index 5d550e1d..803ffc3a 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):
@@ -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:
@@ -180,7 +188,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' :