summaryrefslogtreecommitdiff
path: root/lib/ansible/config/manager.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/config/manager.py')
-rw-r--r--lib/ansible/config/manager.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/ansible/config/manager.py b/lib/ansible/config/manager.py
index e1fde1d3..418528ae 100644
--- a/lib/ansible/config/manager.py
+++ b/lib/ansible/config/manager.py
@@ -11,14 +11,13 @@ 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._text import to_text, to_bytes, to_native
+from ansible.module_utils.common.text.converters 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
@@ -64,7 +63,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 colon separated strings.) Split the value and then expand
+ means comma 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.
@@ -144,13 +143,17 @@ 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 = unquote(to_text(value, errors='surrogate_or_strict'))
+ value = to_text(value, errors='surrogate_or_strict')
+ if origin == 'ini':
+ value = unquote(value)
else:
errmsg = 'string'
# defaults to string type
elif isinstance(value, (string_types, AnsibleVaultEncryptedUnicode)):
- value = unquote(to_text(value, errors='surrogate_or_strict'))
+ value = to_text(value, errors='surrogate_or_strict')
+ if origin == 'ini':
+ value = unquote(value)
if errmsg:
raise ValueError('Invalid type provided for "%s": %s' % (errmsg, to_native(value)))