-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Make Salt to return an error on "pkg" modules and states when targeting duplicated package names #62019
Make Salt to return an error on "pkg" modules and states when targeting duplicated package names #62019
Conversation
Hi! I'm your friendly PR bot!You might be wondering what I'm doing commenting here on your PR. Yes, as a matter of fact, I am... I'm just here to help us improve the documentation. I can't respond to Okay... so what do you do? I detect modules that are missing docstrings or "CLI Example" on existing docstrings! So what does that have to do with my PR? I noticed that in this PR there are some files changed that have some of these Okay, what are they? Well, my favorite, is that since you were making changes here I'm hoping that If I can, then what? Well, you can either add them to this PR or add them to another PR. Either way is fine! Well... what if I can't, or don't want to? That's also fine! We appreciate all contributions to the Salt Project. If you Whatever approach you decide to take, just drop a comment here letting us know! Detected Issues (click me)Check Known Missing Docstrings...........................................Failed - hook id: invoke - duration: 1.27s - exit code: 1 Thanks again! |
This needs to be rebased and conflicts resolved |
…targeting-duplicated-package-names
@twangboy thanks for the review! this should be now ready as I fixed your suggestion 👍 |
The bug seems to be that we should fix the ability to use different versions with the same package name. Is there a reason for not taking this approach? |
bump @meaksh ^ |
Hey @Ch3LL, thanks for reviewing here and sorry for the delay! I see no particular reason against fixing the ability properly on As I mentioned on the description, this PR is not changing the logic to allow duplicated but instead is making Salt to raise an error to avoid getting inconsistent results. Adding support to Hth! |
What does this PR do?
This PR makes Salt to raise a
CommandExecutionError
when executingpkg
modules or states and you are targeting several packages viapkgs
argument but containing duplicated packages names in this list.Currently, the logic around
pkg_resource
andrepack_pkgs
override possible duplicates, which leads into unexpected and inconsistent situations. This PR is not changing the logic to allow duplicated but instead making Salt to raise an error to avoid getting inconsistent results.Previous Behavior
Given I have the following duplicated packages installed on my instance:
And given I have also this state SLS:
When I execute my test state:
As you can see, this result is a bit unexpected, as the state execution succeeded but it didn't really removed all the targeted packages (as it claims), but only the latest one specified in the
pkgs
list.Now if I retrigger my state execution (given the last specified package in the list was already removed by previous run), then I got a completely wrong and inconsistent result:
And this result is of course, not correct:
New Behavior
With the new behavior implemented in this PR, we are making Salt to raise an error when the user is passing duplicated names in the
pkgs
list, to make it clear this cannot be processed and the user needs to manage each duplicated package individually:Adding support to
pkg_resources
andpkgs
modules to allow targeting duplicated package names is a different story which is not the purpose of this PR.What do you think about this? Thanks!
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes