summaryrefslogtreecommitdiff
path: root/cloudinit/user_data.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-20 17:13:55 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-20 17:13:55 -0700
commitec4bdc4fb8d8d3a8f8b4f498eb47eac740485ede (patch)
tree306886dd731180f1c51583679a7bb33c7c7f10d8 /cloudinit/user_data.py
parent5c5525b35970611a5c4dbd44c5c6b6e2d57556cb (diff)
downloadvyos-cloud-init-ec4bdc4fb8d8d3a8f8b4f498eb47eac740485ede.tar.gz
vyos-cloud-init-ec4bdc4fb8d8d3a8f8b4f498eb47eac740485ede.zip
Massive pylint + pep8 fixups!
Diffstat (limited to 'cloudinit/user_data.py')
-rw-r--r--cloudinit/user_data.py28
1 files changed, 12 insertions, 16 deletions
diff --git a/cloudinit/user_data.py b/cloudinit/user_data.py
index b7902d44..4babb8e5 100644
--- a/cloudinit/user_data.py
+++ b/cloudinit/user_data.py
@@ -65,33 +65,33 @@ class UserDataProcessor(object):
# multipart/* are just containers
if part.get_content_maintype() == 'multipart':
continue
-
+
ctype = None
ctype_orig = part.get_content_type()
payload = part.get_payload(decode=True)
-
+
if not ctype_orig:
ctype_orig = UNDEF_TYPE
-
+
if ctype_orig in TYPE_NEEDED:
ctype = handlers.type_from_starts_with(payload)
-
+
if ctype is None:
ctype = ctype_orig
-
+
if ctype in INCLUDE_TYPES:
self._do_include(payload, append_msg)
continue
-
+
if ctype in ARCHIVE_TYPES:
self._explode_archive(payload, append_msg)
continue
-
+
if 'Content-Type' in base_msg:
base_msg.replace_header('Content-Type', ctype)
else:
base_msg['Content-Type'] = ctype
-
+
self._attach_part(append_msg, part)
def _get_include_once_filename(self, entry):
@@ -108,8 +108,8 @@ class UserDataProcessor(object):
lc_line = line.lower()
if lc_line.startswith("#include-once"):
line = line[len("#include-once"):].lstrip()
- # Every following include will now
- # not be refetched.... but will be
+ # Every following include will now
+ # not be refetched.... but will be
# re-read from a local urlcache (if it worked)
include_once_on = True
elif lc_line.startswith("#include"):
@@ -190,10 +190,10 @@ class UserDataProcessor(object):
"""
if ATTACHMENT_FIELD not in outer_msg:
outer_msg[ATTACHMENT_FIELD] = '0'
-
+
if new_count is not None:
outer_msg.replace_header(ATTACHMENT_FIELD, str(new_count))
-
+
fetched_count = 0
try:
fetched_count = int(outer_msg.get(ATTACHMENT_FIELD))
@@ -234,7 +234,3 @@ def convert_string(raw_data, headers=None):
msg = MIMEBase(maintype, subtype, *headers)
msg.set_payload(data)
return msg
-
-
-
-