diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index fbd1cdf468..0da00053a0 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -1240,10 +1240,7 @@ class AnsibleModule(object): def _load_params(self): ''' read the input and return a dictionary and the arguments string ''' - params = json.loads(MODULE_COMPLEX_ARGS) - if str is bytes: - # Python 2 - params = json_dict_unicode_to_bytes(params) + params = json_dict_unicode_to_bytes(json.loads(MODULE_COMPLEX_ARGS)) if params is None: params = dict() return params diff --git a/test/units/module_utils/test_basic.py b/test/units/module_utils/test_basic.py index 78116847de..8e3e802180 100644 --- a/test/units/module_utils/test_basic.py +++ b/test/units/module_utils/test_basic.py @@ -21,6 +21,7 @@ from __future__ import (absolute_import, division) __metaclass__ = type import errno +import sys from six.moves import builtins @@ -220,7 +221,8 @@ class TestModuleUtilsBasic(unittest.TestCase): from ansible.module_utils.basic import get_module_path with patch('os.path.realpath', return_value='/path/to/foo/'): self.assertEqual(get_module_path(), '/path/to/foo') - + + @unittest.skipIf(sys.version_info[0] >= 3, "Python 3 is not supported on targets (yet)") def test_module_utils_basic_ansible_module_creation(self): from ansible.module_utils import basic