Added version argument to @depends decorator to enforce a minimum ver...#53658
Closed
github-abcde wants to merge 7 commits intosaltstack:developfrom
Closed
Added version argument to @depends decorator to enforce a minimum ver...#53658github-abcde wants to merge 7 commits intosaltstack:developfrom
github-abcde wants to merge 7 commits intosaltstack:developfrom
Conversation
…sion requirement.
Contributor
|
Nice! Could this be merged to Neon? |
Contributor
Author
|
Hmm, apparently somewhere, a unicode character (the triple-dots) was introduced into the commit description, and that is causing several tests to fail (at least that is what it looks like to me). Is this something I can fix on my end (and how)? |
Fixed logic path when version is insufficient. Added version parameter in unloading log message if used.
Contributor
Author
|
Ok, that seems to have fixed the failing builds. |
Contributor
|
Ask someone from SaltStack if that is possible, and if they agree then rebase against neon branch. |
twangboy
approved these changes
Jul 1, 2019
Closed
Contributor
Author
|
Closed in favor of #55590 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
...sion requirement.
What does this PR do?
It adds a
versionkwarg to the @Depends decorator, which can handle any value that is able to be parsed withsalt.utils.version.LooseVersion. The value of this version kwarg will be compared to the__version__-attribute of the module mentioned in the decorator (if it cannot be found (because it is a command or the module does not have the attribute), it will silently default toNone). If the version is not equal or larger than the determined version (noting that when the latter isNone, everything will be either equal (alsoNone) or greater (any value)), the specific function will be removed byenforce_dependencies.What issues does this PR fix or reference?
None that I know of
Previous Behavior
The @Depends decorator can only specify whether or not a module needs to be loaded.
New Behavior
The @Depends decorator can also specify a specific minimum version for the module that needs to be loaded.
Tests written?
No, there are tests in
tests/integration/modules/test_decorators.py, but I have no idea how those work.Commits signed with GPG?
Yes