mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Compatibility with six-1.3.0
This commit is contained in:
parent
30399edada
commit
c1039de70c
2 changed files with 7 additions and 7 deletions
|
@ -187,10 +187,10 @@ class Ec2Inventory(object):
|
||||||
|
|
||||||
def read_settings(self):
|
def read_settings(self):
|
||||||
''' Reads the settings from the ec2.ini file '''
|
''' Reads the settings from the ec2.ini file '''
|
||||||
if six.PY2:
|
if six.PY3:
|
||||||
config = configparser.SafeConfigParser()
|
|
||||||
else:
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
|
else:
|
||||||
|
config = configparser.SafeConfigParser()
|
||||||
ec2_default_ini_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ec2.ini')
|
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)))
|
ec2_ini_path = os.path.expanduser(os.path.expandvars(os.environ.get('EC2_INI_PATH', ec2_default_ini_path)))
|
||||||
config.read(ec2_ini_path)
|
config.read(ec2_ini_path)
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from six import PY2
|
from six import PY3
|
||||||
from yaml.scanner import ScannerError
|
from yaml.scanner import ScannerError
|
||||||
|
|
||||||
from ansible.compat.tests import unittest
|
from ansible.compat.tests import unittest
|
||||||
|
@ -81,10 +81,10 @@ class TestDataLoaderWithVault(unittest.TestCase):
|
||||||
3135306561356164310a343937653834643433343734653137383339323330626437313562306630
|
3135306561356164310a343937653834643433343734653137383339323330626437313562306630
|
||||||
3035
|
3035
|
||||||
"""
|
"""
|
||||||
if PY2:
|
if PY3:
|
||||||
builtins_name = '__builtin__'
|
|
||||||
else:
|
|
||||||
builtins_name = 'builtins'
|
builtins_name = 'builtins'
|
||||||
|
else:
|
||||||
|
builtins_name = '__builtin__'
|
||||||
|
|
||||||
with patch(builtins_name + '.open', mock_open(read_data=vaulted_data)):
|
with patch(builtins_name + '.open', mock_open(read_data=vaulted_data)):
|
||||||
output = self._loader.load_from_file('dummy_vault.txt')
|
output = self._loader.load_from_file('dummy_vault.txt')
|
||||||
|
|
Loading…
Reference in a new issue