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

zypper_repository: extend module with possibility to modify repos #8795

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

computersalat
Copy link

SUMMARY

Extend module to also modify (zypper mr) repos.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

zypper_repository

ADDITIONAL INFORMATION

I missed the possibility to modify (zypper mr) existing repositories like enable or disable. I didn't like the add and remove only approach because I created the repo files via templates with my own naming scheme.
Especially when you want to do a zypper dup you need to add the new repos enabled while disabling current repos.
This extension gives the user more possibilies to use this module.

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module module new_contributor Help guide this first time contributor plugins plugin (any type) labels Aug 24, 2024
@computersalat computersalat force-pushed the zypper_repository branch 3 times, most recently from bdf0dd3 to 3931bf5 Compare August 24, 2024 16:37
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-9 Automatically create a backport for the stable-9 branch labels Aug 24, 2024
@ansibullbot ansibullbot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Aug 24, 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.

Thanks for your contribution!

plugins/modules/zypper_repository.py Outdated Show resolved Hide resolved
type: str
state:
action:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please note that module options such as action are not a good idea (https://docs.ansible.com/ansible/devel/dev_guide/developing_modules_best_practices.html#designing-module-interfaces), in particular if state is already present.

All your actions should already be doable with state. Modifying should be done with state=present and passing other parameters.

Copy link
Author

@computersalat computersalat Aug 25, 2024

Choose a reason for hiding this comment

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

I hear you, but state with [ "absent", "present" ] is only relevant when using add or remove, but it's irrelevant when using action with [ "modify" ]. When I modify a repo I expect it to be present.
Introducing action was IMHO the only possibility to add feature: modify.
If you have a better idea, I am open to hear ...

Copy link
Collaborator

Choose a reason for hiding this comment

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

No, state=present usually also means modify (except in certain situations, like it hasn't been implemented yet).

Please remove the action option and change the code so that with state=present it creates (if it doesn't exist yet) or modifies (if it does exist and is changed).

@ansibullbot ansibullbot added the stale_ci CI is older than 7 days, rerun before merging label Sep 3, 2024
@felixfontein felixfontein removed the backport-9 Automatically create a backport for the stable-9 branch label Oct 7, 2024
@felixfontein
Copy link
Collaborator

@computersalat ping

needs_info

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

@computersalat This pullrequest is waiting for your response. Please respond or the pullrequest will be closed.

click here for bot help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
check-before-release PR will be looked at again shortly before release and merged if possible. feature This issue/PR relates to a feature request module module needs_info This issue requires further information. Please answer any outstanding questions 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) stale_ci CI is older than 7 days, rerun before merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants