ini_file: fix unmatched whitespace before comment (#10102)

* ini_file: fix unmatched whitespace before comment

* Add changelog fragment

* Update changelog fragment: bugfixes to minor_changes

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: sibebleuze <>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Sibe Bleuzé 2025-05-10 13:21:36 +02:00 committed by GitHub
commit 43eb342b18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 53 additions and 9 deletions

View file

@ -120,4 +120,46 @@
that:
- result3 is changed
- result3.msg == 'option changed'
- content3 == expected3
- content3 == expected3
- name: test-modify_inactive_option 4 - create test file with spaces before commented option
copy:
content: |
[section1]
# Uncomment the line below to enable foo
# foo = bar
dest: "{{ output_file }}"
- name: test-modify_inactive_option 4 - set value for foo with modify_inactive_option set to true
ini_file:
path: "{{ output_file }}"
section: section1
option: foo
value: bar
modify_inactive_option: true
register: result4
- name: test-modify_inactive_option 4 - read content from output file
slurp:
src: "{{ output_file }}"
register: output_content
- name: test-modify_inactive_option 4 - set expected content and get current ini file content
set_fact:
expected4: |
[section1]
# Uncomment the line below to enable foo
foo = bar
content4: "{{ output_content.content | b64decode }}"
- name: test-modify_inactive_option 4 - assert 'changed' is true and content is OK and option changed
assert:
that:
- result4 is changed
- result4.msg == 'option changed'
- content4 == expected4