-
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
Allow using salt modules in onlyif and unless #51846
Conversation
@saltstack/team-core can I get a review on this. Thanks! |
Ok, this should be good to merge 😄 |
This is pretty major and should get a shout out in the release notes too |
@gtmanfred Unfortunately, this doesn't work consistently across all states and needs to be improved. The following states have their own
This is where unless/onlyif get skipped: https://github.com/saltstack/salt/blob/develop/salt/state.py#L1955-L1957 I discovered this while trying to fix slots #53307 |
In glancing over those states, it's not immediately obvious why they have their own |
They had unless and onlyif implementations before unless and onlyif was implemented, and unless/onlyif was a simpler implementation, so instead of having to make compatible changes for everything that the cmd.run onlyif did, i just let it be configured to be able to customize it. |
Allow using salt modules in onlyif and unless
This seems to have been corrupted by a bad merge when merging saltstack#51846
What does this PR do?
Allow using salt modules in onlyif and unless
What issues does this PR fix or reference?
Implements #5050
Implements #51604
Previous Behavior
Can only use commands that run through cmd.retcode
New Behavior
Can use any salt module, and the result is determined by the trueish or falsish return of the module.
Tests written?
Yes
Commits signed with GPG?
Yes