1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

unquote strings in the ansible config file

This commit is contained in:
Toshio Kuratomi 2015-07-06 14:12:10 -07:00
parent f44f9569e1
commit 5b0b1f8da6

View file

@ -22,10 +22,12 @@ __metaclass__ = type
import os import os
import pwd import pwd
import sys import sys
from six.moves import configparser
from string import ascii_letters, digits from string import ascii_letters, digits
from six import string_types
from six.moves import configparser
from ansible.parsing.splitter import unquote
from ansible.errors import AnsibleOptionsError from ansible.errors import AnsibleOptionsError
# copied from utils, avoid circular reference fun :) # copied from utils, avoid circular reference fun :)
@ -49,8 +51,10 @@ def get_config(p, section, key, env_var, default, boolean=False, integer=False,
elif floating: elif floating:
value = float(value) value = float(value)
elif islist: elif islist:
if isinstance(value, basestring): if isinstance(value, string_types):
value = [x.strip() for x in value.split(',')] value = [x.strip() for x in value.split(',')]
elif isinstance(value, string_types):
value = unquote(value)
return value return value
def _get_config(p, section, key, env_var, default): def _get_config(p, section, key, env_var, default):