1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-03-21 20:59:10 +00:00

adds parameter delimiters to from_ini filter (#11512)

* adds parameter delimiters to from_ini filter

fixes issue #11506

* adds changelog fragment

* fixes pylint dangerous-default-value / W0102

* does not assume default delimiters

let that be decided in the super class

* Update plugins/filter/from_ini.py

verbose description

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

* Update changelogs/fragments/11512-from_ini-delimiters.yaml

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

* adds input validation

* adss check for delimiters not None

* adds missing import

* removes the negation

* adds suggestions from russoz

* adds ruff format suggestion

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Robert Sander 2026-02-23 05:44:32 +01:00 committed by GitHub
parent ce7cb4e914
commit aec0e61ba1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 52 additions and 4 deletions

View file

@ -41,6 +41,32 @@
- 'ini_file_content.content | b64decode | community.general.from_ini ==
ini_test_dict'
- name: 'Define another ini_test_dict'
ansible.builtin.set_fact:
ini_test_dict:
section_name:
'key_name * : with spaces': 'key value'
- name: 'Write another INI file that reflects ini_test_dict to {{ ini_test_file }}'
ansible.builtin.copy:
dest: '{{ ini_test_file }}'
content: |
[section_name]
key_name * : with spaces = key value
- name: 'Slurp the other test file: {{ ini_test_file }}'
ansible.builtin.slurp:
src: '{{ ini_test_file }}'
register: 'ini_file_content'
- name: >-
Ensure defined ini_test_dict is the same when retrieved
from other {{ ini_test_file }}
ansible.builtin.assert:
that:
- 'ini_file_content.content | b64decode | community.general.from_ini(delimiters=["="]) ==
ini_test_dict'
- name: 'Create a file that is not INI formatted: {{ ini_bad_file }}'
ansible.builtin.copy:
dest: '{{ ini_bad_file }}'