diff options
| -rw-r--r-- | cloudinit/sources/DataSourceAltCloud.py | 6 | ||||
| -rw-r--r-- | cloudinit/sources/helpers/azure.py | 2 | ||||
| -rw-r--r-- | cloudinit/util.py | 7 | ||||
| -rw-r--r-- | tests/unittests/test_handler/test_handler_apt_conf_v1.py | 2 | ||||
| -rw-r--r-- | tests/unittests/test_util.py | 2 | ||||
| -rw-r--r-- | tox.ini | 16 | 
6 files changed, 23 insertions, 12 deletions
| diff --git a/cloudinit/sources/DataSourceAltCloud.py b/cloudinit/sources/DataSourceAltCloud.py index 48136f7c..20345389 100644 --- a/cloudinit/sources/DataSourceAltCloud.py +++ b/cloudinit/sources/DataSourceAltCloud.py @@ -195,8 +195,7 @@ class DataSourceAltCloud(sources.DataSource):              (cmd_out, _err) = util.subp(cmd)              LOG.debug(('Command: %s\nOutput%s') % (' '.join(cmd), cmd_out))          except ProcessExecutionError as _err: -            util.logexc(LOG, 'Failed command: %s\n%s', ' '.join(cmd), -                        _err.message) +            util.logexc(LOG, 'Failed command: %s\n%s', ' '.join(cmd), _err)              return False          except OSError as _err:              util.logexc(LOG, 'Failed command: %s\n%s', ' '.join(cmd), _err) @@ -211,8 +210,7 @@ class DataSourceAltCloud(sources.DataSource):              (cmd_out, _err) = util.subp(cmd)              LOG.debug(('Command: %s\nOutput%s') % (' '.join(cmd), cmd_out))          except ProcessExecutionError as _err: -            util.logexc(LOG, 'Failed command: %s\n%s', ' '.join(cmd), -                        _err.message) +            util.logexc(LOG, 'Failed command: %s\n%s', ' '.join(cmd), _err)              return False          except OSError as _err:              util.logexc(LOG, 'Failed command: %s\n%s', ' '.join(cmd), diff --git a/cloudinit/sources/helpers/azure.py b/cloudinit/sources/helpers/azure.py index 689ed4cc..1b3e9b70 100644 --- a/cloudinit/sources/helpers/azure.py +++ b/cloudinit/sources/helpers/azure.py @@ -232,7 +232,7 @@ class WALinuxAgentShim(object):      def _get_value_from_leases_file(fallback_lease_file):          leases = []          content = util.load_file(fallback_lease_file) -        LOG.debug("content is {}".format(content)) +        LOG.debug("content is %s", content)          for line in content.splitlines():              if 'unknown-245' in line:                  # Example line from Ubuntu diff --git a/cloudinit/util.py b/cloudinit/util.py index eb3e5899..4cff83c5 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -199,7 +199,7 @@ def fully_decoded_payload(part):              encoding = charset.input_codec          else:              encoding = 'utf-8' -        return cte_payload.decode(encoding, errors='surrogateescape') +        return cte_payload.decode(encoding, 'surrogateescape')      return cte_payload @@ -282,9 +282,6 @@ class ProcessExecutionError(IOError):              'reason': self.reason,          }          IOError.__init__(self, message) -        # For backward compatibility with Python 2. -        if not hasattr(self, 'message'): -            self.message = message  class SeLinuxGuard(object): @@ -1821,7 +1818,7 @@ def subp(args, data=None, rcs=None, env=None, capture=True, shell=False,              def ldecode(data, m='utf-8'):                  if not isinstance(data, bytes):                      return data -                return data.decode(m, errors=decode) +                return data.decode(m, decode)              out = ldecode(out)              err = ldecode(err) diff --git a/tests/unittests/test_handler/test_handler_apt_conf_v1.py b/tests/unittests/test_handler/test_handler_apt_conf_v1.py index 45714efd..64acc3e0 100644 --- a/tests/unittests/test_handler/test_handler_apt_conf_v1.py +++ b/tests/unittests/test_handler/test_handler_apt_conf_v1.py @@ -118,7 +118,7 @@ class TestConversion(TestCase):      def test_convert_with_apt_mirror(self):          mirror = 'http://my.mirror/ubuntu'          f = cc_apt_configure.convert_to_v3_apt_format({'apt_mirror': mirror}) -        self.assertIn(mirror, {m['uri'] for m in f['apt']['primary']}) +        self.assertIn(mirror, set(m['uri'] for m in f['apt']['primary']))      def test_no_old_content(self):          mirror = 'http://my.mirror/ubuntu' diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py index fc6b9d40..881509aa 100644 --- a/tests/unittests/test_util.py +++ b/tests/unittests/test_util.py @@ -553,7 +553,7 @@ class TestSubp(helpers.TestCase):      def test_subp_decode_invalid_utf8_replaces(self):          (out, _err) = util.subp(self.stdin2out, capture=True,                                  data=self.utf8_invalid) -        expected = self.utf8_invalid.decode('utf-8', errors='replace') +        expected = self.utf8_invalid.decode('utf-8', 'replace')          self.assertEqual(out, expected)      def test_subp_decode_strict_raises(self): @@ -59,3 +59,19 @@ deps =      pyflakes==1.1.0      flake8==2.5.4      hacking==0.10.2 + +[testenv:centos6] +basepython = python2.6 +commands = nosetests {posargs:tests} +deps = +    # requirements +    argparse==1.2.1 +    jinja2==2.2.1 +    pyyaml==3.10 +    PrettyTable==0.7.2 +    oauthlib==0.6.0 +    configobj==4.6.0 +    requests==2.6.0 +    jsonpatch==1.2 +    six==1.9.0 +    -r{toxinidir}/test-requirements.txt | 
