[PR #10102/43eb342b backport][stable-10] ini_file: fix unmatched whitespace before comment (#10116)
Some checks failed
EOL CI / EOL Sanity (Ⓐ2.15) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py2.7) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py3.10) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py3.5) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/3/) (push) Has been cancelled
nox / Run extra sanity tests (push) Has been cancelled

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: sibebleuze <>

(cherry picked from commit 43eb342b18)

Co-authored-by: Sibe Bleuzé <sibebleuze@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot] 2025-05-10 15:12:54 +02:00 committed by GitHub
commit d557997242
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