summaryrefslogtreecommitdiff
path: root/lib/ansible/config
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2021-02-25 11:03:03 -0600
committerGitHub <noreply@github.com>2021-02-25 11:03:03 -0600
commit950ab74758a6014639236612594118b2b6f4751e (patch)
tree042b6e7b6599f001d5ba24f73678b8403b04f164 /lib/ansible/config
parenteb72c36a71c8bf786d575a31246f602ad69cc9c9 (diff)
downloadansible-950ab74758a6014639236612594118b2b6f4751e.tar.gz
Normalize ConfigParser between Python2 and Python3 (#73715)
* Normalize config parser between py2 and py3 * Add tests and changelog * Use different config entry, since we supply certain env vars
Diffstat (limited to 'lib/ansible/config')
-rw-r--r--lib/ansible/config/manager.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ansible/config/manager.py b/lib/ansible/config/manager.py
index fbc3bcde60..e9a206d9bc 100644
--- a/lib/ansible/config/manager.py
+++ b/lib/ansible/config/manager.py
@@ -329,7 +329,10 @@ class ConfigManager(object):
ftype = get_config_type(cfile)
if cfile is not None:
if ftype == 'ini':
- self._parsers[cfile] = configparser.ConfigParser()
+ kwargs = {}
+ if PY3:
+ kwargs['inline_comment_prefixes'] = (';',)
+ self._parsers[cfile] = configparser.ConfigParser(**kwargs)
with open(to_bytes(cfile), 'rb') as f:
try:
cfg_text = to_text(f.read(), errors='surrogate_or_strict')