-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Update dnf.py #79679
Update dnf.py #79679
Conversation
Fix ansible-lint error: "Package installs should not use latest."
Thanks for your Ansible docs contribution! We talk about Ansible documentation on matrix at #docs:ansible.im and on libera IRC at #ansible-docs if you ever want to join us and chat about the docs! We meet there on Tuesdays (see the Ansible calendar) and welcome additions to our weekly agenda items - scroll down to find the upcoming agenda and add a comment to put something new on that agenda. |
lib/ansible/modules/dnf.py
Outdated
@@ -317,6 +317,7 @@ | |||
ansible.builtin.dnf: | |||
name: "*" | |||
state: latest | |||
update_only: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would prevent any dependencies introduced in new versions of packages not being installed and ultimately failing the upgrade. I believe wanting to upgrade all packages regardless of whether they pull in new packages as their dependencies is a valid use case that is worth documenting.
We have two examples here that use 'latest'. Both would cause an ansible/lib/ansible/modules/dnf.py Line 288 in 49ed148
And change the name to "Update to latest version of Apache but do not install new dependencies" Or something like that to make clear what it is doing? |
IMHO I would ignore this lint error. Using Also, the lint error can be suppressed like so: state: latest # noqa package-latest Having said that I agree that the use of I would add a new example that would better describe the intent of - name: Update the webserver, depending on which is installed on the system, do not install the other one
ansible.builtin.dnf:
name:
- httpd
- nginx
state: latest
update_only: yes (the description in What do you think @samccann? |
@ssbarnea - do you have an opinion here since we're talking about ansible-lint errors ? |
Thanks for pinging me. Yep, I think that it is a good idea to update the docs and use an example that is closer to what people are expected to use, and avoid use of examples that would not pass our linting. |
@samccann In case you haven't seen it already, here's ansible-lint's rationale https://github.com/ansible/ansible-lint/blob/dd29bc01d8643d7c016281158bde9eb4743d2346/src/ansiblelint/rules/package_latest.md. This PR wouldn't hide all examples that break the rule (at a glance, I see it in the |
Thanks @wireboot for the PR and initiating the conversation around this fix! And welcome to the Ansible project. |
SUMMARY
Fix ansible-lint error: "Package installs should not use latest."
ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION
Example