summaryrefslogtreecommitdiff
path: root/cloudinit/helpers.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2015-01-21 17:56:53 -0500
committerBarry Warsaw <barry@python.org>2015-01-21 17:56:53 -0500
commitf895cb12141281702b34da18f2384deb64c881e7 (patch)
tree7a7433752ba1317c370dd3dd815c9ee7331a923b /cloudinit/helpers.py
parenta64bb4febc79fcf641f6471d8cc00c74ca915f3d (diff)
downloadvyos-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/helpers.py')
-rw-r--r--cloudinit/helpers.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/cloudinit/helpers.py b/cloudinit/helpers.py
index e701126e..ed396b5a 100644
--- a/cloudinit/helpers.py
+++ b/cloudinit/helpers.py
@@ -23,10 +23,11 @@
from time import time
import contextlib
-import io
import os
-from ConfigParser import (NoSectionError, NoOptionError, RawConfigParser)
+import six
+from six.moves.configparser import (
+ NoSectionError, NoOptionError, RawConfigParser)
from cloudinit.settings import (PER_INSTANCE, PER_ALWAYS, PER_ONCE,
CFG_ENV_NAME)
@@ -318,10 +319,10 @@ class ContentHandlers(object):
return self.registered[content_type]
def items(self):
- return self.registered.items()
+ return list(self.registered.items())
- def iteritems(self):
- return self.registered.iteritems()
+ # XXX This should really go away.
+ iteritems = items
class Paths(object):
@@ -449,7 +450,7 @@ class DefaultingConfigParser(RawConfigParser):
def stringify(self, header=None):
contents = ''
- with io.BytesIO() as outputstream:
+ with six.StringIO() as outputstream:
self.write(outputstream)
outputstream.flush()
contents = outputstream.getvalue()