diff options
author | Barry Warsaw <barry@python.org> | 2015-01-21 17:56:53 -0500 |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2015-01-21 17:56:53 -0500 |
commit | f895cb12141281702b34da18f2384deb64c881e7 (patch) | |
tree | 7a7433752ba1317c370dd3dd815c9ee7331a923b /cloudinit/user_data.py | |
parent | a64bb4febc79fcf641f6471d8cc00c74ca915f3d (diff) | |
download | vyos-cloud-init-f895cb12141281702b34da18f2384deb64c881e7.tar.gz vyos-cloud-init-f895cb12141281702b34da18f2384deb64c881e7.zip |
Largely merge lp:~harlowja/cloud-init/py2-3 albeit manually because it seemed
to be behind trunk.
`tox -e py27` passes full test suite. Now to work on replacing mocker.
Diffstat (limited to 'cloudinit/user_data.py')
-rw-r--r-- | cloudinit/user_data.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cloudinit/user_data.py b/cloudinit/user_data.py index de6487d8..9111bd39 100644 --- a/cloudinit/user_data.py +++ b/cloudinit/user_data.py @@ -29,6 +29,8 @@ from email.mime.multipart import MIMEMultipart from email.mime.nonmultipart import MIMENonMultipart from email.mime.text import MIMEText +import six + from cloudinit import handlers from cloudinit import log as logging from cloudinit import util @@ -235,7 +237,7 @@ class UserDataProcessor(object): resp = util.read_file_or_url(include_url, ssl_details=self.ssl_details) if include_once_on and resp.ok(): - util.write_file(include_once_fn, str(resp), mode=0600) + util.write_file(include_once_fn, str(resp), mode=0o600) if resp.ok(): content = str(resp) else: @@ -256,7 +258,7 @@ class UserDataProcessor(object): # filename and type not be present # or # scalar(payload) - if isinstance(ent, (str, basestring)): + if isinstance(ent, six.string_types): ent = {'content': ent} if not isinstance(ent, (dict)): # TODO(harlowja) raise? @@ -337,7 +339,7 @@ def convert_string(raw_data, headers=None): data = util.decomp_gzip(raw_data) if "mime-version:" in data[0:4096].lower(): msg = email.message_from_string(data) - for (key, val) in headers.iteritems(): + for (key, val) in headers.items(): _replace_header(msg, key, val) else: mtype = headers.get(CONTENT_TYPE, NOT_MULTIPART_TYPE) |