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 #4428 from robparrott/devel

Properly handle DEFAULT section with ConfigParser in ini_file modules
This commit is contained in:
jctanner 2013-10-16 17:18:17 -07:00
commit 51a1a54bfb

View file

@ -116,9 +116,9 @@ def do_ini(module, filename, section=None, option=None, value=None, state='prese
pass
if state == 'present':
if cp.has_section(section) == False:
if section.upper() == 'DEFAULT':
module.fail_json(msg="[DEFAULT] is an illegal section name")
# DEFAULT section is always there by DEFAULT, so never try to add it.
if cp.has_section(section) == False and section.upper() != 'DEFAULT':
cp.add_section(section)
changed = True