Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ini_file - add feature 'section_has_values' #7505

Merged

Conversation

jakob-bebop
Copy link
Contributor

SUMMARY

ini_file: Add an optional parameter section_has. If the target ini file contains more than one section, use section_has to specify which one should be updated.

Use case: In wireguard config there can be multiple [Peer] sections. See example in source code doc string

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

ini_file

@ansibullbot

This comment was marked as outdated.

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module module needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR new_contributor Help guide this first time contributor plugins plugin (any type) labels Nov 9, 2023
@ansibullbot

This comment was marked as outdated.

@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-8 Automatically create a backport for the stable-8 branch labels Nov 9, 2023
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't had time to read the change in detail, but here are some first comments from a quick glance:

plugins/modules/ini_file.py Outdated Show resolved Hide resolved
plugins/modules/ini_file.py Outdated Show resolved Hide resolved
plugins/modules/ini_file.py Outdated Show resolved Hide resolved
@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Nov 9, 2023
plugins/modules/ini_file.py Outdated Show resolved Hide resolved
plugins/modules/ini_file.py Outdated Show resolved Hide resolved
@ansibullbot ansibullbot added the stale_ci CI is older than 7 days, rerun before merging label Nov 20, 2023
@ansibullbot ansibullbot added needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Nov 28, 2023
@felixfontein
Copy link
Collaborator

needs_info

@ansibullbot ansibullbot added the needs_info This issue requires further information. Please answer any outstanding questions label Jan 29, 2024
@ansibullbot
Copy link
Collaborator

@jakob-bebop this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibullbot ansibullbot added merge_commit This PR contains at least one merge commit. Please resolve! and removed stale_ci CI is older than 7 days, rerun before merging needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Feb 27, 2024
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Feb 27, 2024
@jakob-bebop
Copy link
Contributor Author

  • changed the name of the config option to use the more explicit name proposed above.
  • added some test cases in tests/integration/targets/ini_file/tasks/tests/07-section.yml. The existing section functionality seems to be covered in the 02-values.yml
  • I set version_added to 8.5 in the docstring

@ansibullbot ansibullbot removed the needs_info This issue requires further information. Please answer any outstanding questions label Feb 27, 2024
plugins/modules/ini_file.py Outdated Show resolved Hide resolved
plugins/modules/ini_file.py Outdated Show resolved Hide resolved
plugins/modules/ini_file.py Outdated Show resolved Hide resolved
@jakob-bebop jakob-bebop force-pushed the ini_file/section_has-2 branch from 2dccddb to fdfbaf6 Compare March 28, 2024 13:26
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI integration tests/integration tests tests and removed merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html stale_ci CI is older than 7 days, rerun before merging labels Mar 28, 2024
@ansibullbot ansibullbot removed ci_verified Push fixes to PR branch to re-run CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Mar 28, 2024
@ansibullbot ansibullbot added the stale_ci CI is older than 7 days, rerun before merging label Apr 6, 2024
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some more nits. Please note that there are some other suggestions that are still open.

plugins/modules/ini_file.py Outdated Show resolved Hide resolved
plugins/modules/ini_file.py Outdated Show resolved Hide resolved
plugins/modules/ini_file.py Outdated Show resolved Hide resolved
@felixfontein
Copy link
Collaborator

If nobody objects, I'll merge this on the upcoming weekend (after applying the remaining suggestions if they haven't been applied yet).

@ansibullbot ansibullbot removed the stale_ci CI is older than 7 days, rerun before merging label Apr 19, 2024
@felixfontein felixfontein merged commit be4d5b7 into ansible-collections:main Apr 20, 2024
132 of 133 checks passed
Copy link

patchback bot commented Apr 20, 2024

Backport to stable-8: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-8/be4d5b7dc4d63d3a828fd480f9728ce012310133/pr-7505

Backported as #8250

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Apr 20, 2024
* insert new code

* add changelog

* add argument_spec

* sanity check

* docstring version_added

* version-added-must-be-major-or-minor

* Update plugins/modules/ini_file.py

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

* check for default value  `None`

* typo in example

* add integration test and rename option

* add license

* update "version added" in docstring

* insert new code

* remove whitespace

* update examples

* support exclusive, allow_no_value, multiple values in section_has_values

* prefer Todd's variable naming in loops

* resolve number clash in file names

* pass sanity test validate-modules

* Documentation updates

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Todd Lewis <todd_lewis@unc.edu>
(cherry picked from commit be4d5b7)
@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Apr 20, 2024
@felixfontein
Copy link
Collaborator

@jakob-bebop @utoddl thanks for your contributions!
@russoz @jpmens thanks for reviewing!

felixfontein pushed a commit that referenced this pull request Apr 20, 2024
…n_has_values' (#8250)

ini_file - add feature 'section_has_values' (#7505)

* insert new code

* add changelog

* add argument_spec

* sanity check

* docstring version_added

* version-added-must-be-major-or-minor

* Update plugins/modules/ini_file.py

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

* check for default value  `None`

* typo in example

* add integration test and rename option

* add license

* update "version added" in docstring

* insert new code

* remove whitespace

* update examples

* support exclusive, allow_no_value, multiple values in section_has_values

* prefer Todd's variable naming in loops

* resolve number clash in file names

* pass sanity test validate-modules

* Documentation updates

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Todd Lewis <todd_lewis@unc.edu>
(cherry picked from commit be4d5b7)

Co-authored-by: Jakob Lund <jakob@avforlaget.dk>
aretrosen pushed a commit to aretrosen/community.general that referenced this pull request Apr 22, 2024
* insert new code

* add changelog

* add argument_spec

* sanity check

* docstring version_added

* version-added-must-be-major-or-minor

* Update plugins/modules/ini_file.py

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

* check for default value  `None`

* typo in example

* add integration test and rename option

* add license

* update "version added" in docstring

* insert new code

* remove whitespace

* update examples

* support exclusive, allow_no_value, multiple values in section_has_values

* prefer Todd's variable naming in loops

* resolve number clash in file names

* pass sanity test validate-modules

* Documentation updates

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Todd Lewis <todd_lewis@unc.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8 Automatically create a backport for the stable-8 branch feature This issue/PR relates to a feature request integration tests/integration module module new_contributor Help guide this first time contributor plugins plugin (any type) tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants