diff options
Diffstat (limited to 'lib/ansible/config/manager.py')
-rw-r--r-- | lib/ansible/config/manager.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/ansible/config/manager.py b/lib/ansible/config/manager.py index 418528ae..e1fde1d3 100644 --- a/lib/ansible/config/manager.py +++ b/lib/ansible/config/manager.py @@ -11,13 +11,14 @@ import os.path import sys import stat import tempfile +import traceback from collections import namedtuple from collections.abc import Mapping, Sequence from jinja2.nativetypes import NativeEnvironment from ansible.errors import AnsibleOptionsError, AnsibleError -from ansible.module_utils.common.text.converters import to_text, to_bytes, to_native +from ansible.module_utils._text import to_text, to_bytes, to_native from ansible.module_utils.common.yaml import yaml_load from ansible.module_utils.six import string_types from ansible.module_utils.parsing.convert_bool import boolean @@ -63,7 +64,7 @@ def ensure_type(value, value_type, origin=None): :temppath: Same as 'tmppath' :tmp: Same as 'tmppath' :pathlist: Treat the value as a typical PATH string. (On POSIX, this - means comma separated strings.) Split the value and then expand + means colon separated strings.) Split the value and then expand each part for environment variables and tildes. :pathspec: Treat the value as a PATH string. Expands any environment variables tildes's in the value. @@ -143,17 +144,13 @@ def ensure_type(value, value_type, origin=None): elif value_type in ('str', 'string'): if isinstance(value, (string_types, AnsibleVaultEncryptedUnicode, bool, int, float, complex)): - value = to_text(value, errors='surrogate_or_strict') - if origin == 'ini': - value = unquote(value) + value = unquote(to_text(value, errors='surrogate_or_strict')) else: errmsg = 'string' # defaults to string type elif isinstance(value, (string_types, AnsibleVaultEncryptedUnicode)): - value = to_text(value, errors='surrogate_or_strict') - if origin == 'ini': - value = unquote(value) + value = unquote(to_text(value, errors='surrogate_or_strict')) if errmsg: raise ValueError('Invalid type provided for "%s": %s' % (errmsg, to_native(value))) |