Skip to content

Commit

Permalink
[PR #6404/e49c6a33 backport][stable-6] ini_file: removing required=tr…
Browse files Browse the repository at this point in the history
…ue for 'section' option (#6411)

ini_file: removing required=true for 'section' option (#6404)

Fix ini_file by removing required=true for 'section' option.

(cherry picked from commit e49c6a3)

Co-authored-by: Felix Fontein <felix@fontein.de>
  • Loading branch information
patchback[bot] and felixfontein authored Apr 23, 2023
1 parent eca6494 commit 5fe1091
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/6404-ini_file-section.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "ini_file - make ``section`` parameter not required so it is possible to pass ``null`` as a value. This only was possible in the past due to a bug in ansible-core that now has been fixed (https://github.com/ansible-collections/community.general/pull/6404)."
5 changes: 2 additions & 3 deletions plugins/modules/ini_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@
description:
- Section name in INI file. This is added if I(state=present) automatically when
a single value is being set.
- If left empty or set to C(null), the I(option) will be placed before the first I(section).
- If left empty, being omitted, or being set to C(null), the I(option) will be placed before the first I(section).
- Using C(null) is also required if the config format does not support sections.
type: str
required: true
option:
description:
- If set (required for changing a I(value)), this is the name of the option.
Expand Down Expand Up @@ -430,7 +429,7 @@ def main():
module = AnsibleModule(
argument_spec=dict(
path=dict(type='path', required=True, aliases=['dest']),
section=dict(type='str', required=True),
section=dict(type='str'),
option=dict(type='str'),
value=dict(type='str'),
values=dict(type='list', elements='str'),
Expand Down

0 comments on commit 5fe1091

Please sign in to comment.