-
Notifications
You must be signed in to change notification settings - Fork 5.5k
pkg.installed version parameter support for multiple conditions #48511
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
Conversation
…s to allow version ranges and exclusions, for more control over what versions will be installed.
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.
Looks good to me 👍. Thanks @0w3w for contributing!
Hi @0w3w - Can you fix these pylint errors? https://jenkins.saltstack.com/job/PR/job/salt-pr-lint-n/23211/violations/ |
@rallytime pylint errors fixed! |
tests/unit/utils/test_pkg.py
Outdated
|
||
def test_split_comparison(self): | ||
''' | ||
Test passing a jid on the command line |
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.
I don't think that this test has anything to do with JIDs. Bad copy-and-paste?
tests/unit/utils/test_pkg.py
Outdated
''' | ||
Test passing a jid on the command line | ||
''' | ||
for test_parameter in PkgUtilsTestCase.test_parameters: |
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.
There is no need to refer to class attributes here are they are inherited by the instance. You can use self.test_parameters
here.
@terminalmage Comments addressed, good catch, thanks for the review! |
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.
Hi 0w3w This change assumes comma and spaces are not used in a version string. Before it assumed prefix of a version string would not be What happens if 14.0.1 or 17.0 is already installed, is it removed or upgraded or down-graded? I am assume that compare version() is coming from the execution module still.
The following seems to be in only one place.
I would have thought that allow_updates bool check could be removed from other parts of the code if version string is prefixed with |
Hey @damon-atkins You are right, the change assumes version numbers following the debian standard (https://www.debian.org/doc/debian-policy/#version) as well as the classic standard version format (major.minor.update.build), which covers, I would say, all of the versioning schemas. The REGEX part to detect the version string was not change though, so whatever version string was previously supported, will still be supported. The list of operators was expanded to support libsolv-based package managers and debian operators. I have not updated the DOCO as I expect the first pkg provider to claim support for this, to update it. (opkg can be a great provider for this, I'll talk to Alejandro del Castillo, the maintainer of opkg, to see if he can implement this) "What happens if 14.0.1 or 17.0 is already installed, is it removed or upgraded or down-graded? bar: ' > 12.0.0, < 15.0.0, != 14.0.1'" Didn't make changes to compare_version, should come from the same module. Regarding the allow_updates behavior, I purposefully maintained the existing logic to warranty backwards compatibility and didn't change existing behavior. Thanks for the review! |
Thanks for this addition @0w3w and congrats on your first salt PR! :) |
What does this PR do?
salt.states.pkg.installed supporting multiple version conditions.
Previous Behavior
Support for specifying a package condition in the version was recently added, this to enable more control over what versions will be installed.
E.G.
see https://docs.saltstack.com/en/latest/ref/states/all/salt.states.pkg.html#salt.states.pkg.installed
New Behavior
This feature enables support for multiple conditions, this to allow version ranges and exclusions, which will enable more complex scenarios.
E.G.
Tests written?
Yes