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

Merge pull request #8455 from nicocesar/version_check

if python >=2.7  use the option allow_no_value=True for ini_file.
This commit is contained in:
Michael DeHaan 2014-08-05 21:00:37 -04:00
commit e90d2573d1

View file

@ -87,6 +87,7 @@ EXAMPLES = '''
'''
import ConfigParser
import sys
# ==============================================================
# do_ini
@ -94,6 +95,9 @@ import ConfigParser
def do_ini(module, filename, section=None, option=None, value=None, state='present', backup=False):
changed = False
if (sys.version_info[0] == 2 and sys.version_info[1] >= 7) or sys.version_info[0] >= 3:
cp = ConfigParser.ConfigParser(allow_no_value=True)
else:
cp = ConfigParser.ConfigParser()
cp.optionxform = identity