From c1039de70c737cd85f0b76d015e73f633f7a1095 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Tue, 8 Sep 2015 09:46:12 -0700 Subject: [PATCH] Compatibility with six-1.3.0 --- contrib/inventory/ec2.py | 6 +++--- test/units/parsing/test_data_loader.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/inventory/ec2.py b/contrib/inventory/ec2.py index e4b0b072d4..7ed9b83e77 100755 --- a/contrib/inventory/ec2.py +++ b/contrib/inventory/ec2.py @@ -187,10 +187,10 @@ class Ec2Inventory(object): def read_settings(self): ''' Reads the settings from the ec2.ini file ''' - if six.PY2: - config = configparser.SafeConfigParser() - else: + if six.PY3: config = configparser.ConfigParser() + else: + config = configparser.SafeConfigParser() ec2_default_ini_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ec2.ini') ec2_ini_path = os.path.expanduser(os.path.expandvars(os.environ.get('EC2_INI_PATH', ec2_default_ini_path))) config.read(ec2_ini_path) diff --git a/test/units/parsing/test_data_loader.py b/test/units/parsing/test_data_loader.py index 810cea41d2..ecb10b09b8 100644 --- a/test/units/parsing/test_data_loader.py +++ b/test/units/parsing/test_data_loader.py @@ -19,7 +19,7 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from six import PY2 +from six import PY3 from yaml.scanner import ScannerError from ansible.compat.tests import unittest @@ -81,10 +81,10 @@ class TestDataLoaderWithVault(unittest.TestCase): 3135306561356164310a343937653834643433343734653137383339323330626437313562306630 3035 """ - if PY2: - builtins_name = '__builtin__' - else: + if PY3: builtins_name = 'builtins' + else: + builtins_name = '__builtin__' with patch(builtins_name + '.open', mock_open(read_data=vaulted_data)): output = self._loader.load_from_file('dummy_vault.txt')