-
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
Consolidate some state requisites #55974
Conversation
Neat! I will review the refactored implementation more thoroughly in a couple of days.
|
|
I left the file and macpackage custom implementations, as they looked somewhat state specific. If it was decided to aim for the full superset, those features could be ported too. |
Codecov Report
@@ Coverage Diff @@
## master #55974 +/- ##
=========================================
Coverage ? 38.9%
=========================================
Files ? 1496
Lines ? 262820
Branches ? 55551
=========================================
Hits ? 102232
Misses ? 149031
Partials ? 11557
|
I finally had some time to review/test the patch, and so far, it looks quite good! There are minor differences (for example, how exceptions in I still think it makes sense to add the
I believe that As for And finally, it makes sense to mention this in the release notes, because there is a small risk that the change is not 100% compatible. |
Thanks for the review @max-arnold! I think I've taken care of the STATE_RUNTIME_KEYWORDS adding and some of the needed doc updates. You're right on the file state. So that's an easy one off the list. However, while the macpackage state's salt/salt/states/macpackage.py Line 109 in 01b9405
Since the global Thoughts, and did I catch all the needed docs? |
Found an interesting cheatsheet that states the following:
https://gist.github.com/jfindlay/331a4394281e778a1ae9217edb5728b7 Not sure if the statement is true, but maybe it worth to double check the Other than that, I think it is ready to merge if the tests pass. |
Nice! With the patch, those states still execute as described. (Seems like the expected behavior anyway) Currently this still leaves macpackage as the only state with specialized unless/onlyif and missing out on other requisite capabilities. |
If you really want to fix the Not sure if it is worth the trouble, though. And it is still possible that someone will introduce new state-specific |
Zowie! On further investigation, it appears macpackage doesn't use its local version at all. Here we go: salt/salt/states/macpackage.py Line 248 in 01b9405
As such, the state specific version doesn't cause state.py to not run its own global versions, since it doesn't match the name The only way I foresee the local version ever functioning is in the very special circumstance where This seems a bit far fetched, and as it looks like there aren't any tests for the macpackage state's _mod_run_check, I suspect it has simply never been called and the user functionality is just broken. Can anyone from the MacOS working group confirm? If unused, we might as well remove the confusing code and documentation. For this PR, I think that wraps up the outstanding bits. |
I can take a look at the macpackage state tomorrow. cc @sheagcraig |
@mchugh19 per macOS packages can only be installed as root and attempting to do so as a user will fail. So with that being said, I'm okay with removing the code and the documentation for the macpackage state. |
Actually, after discussion with the macOS workgroup, the change to the macpackage state would break this formula. https://github.com/saltstack-formulas/salt-formula/blob/efc5d7c632834fa7e14f1c2410645a4a6594df6f/salt/minion.sls#L69-L70 @garethgreenaway recommends adding a deprecation notice. |
re-run pr-ubuntu2004-py3 |
What does this PR do?
Attempts to unify some of the
mod_run_check
state implementations. Global requisites onlyif and unless now support use of salt modules as well as slots, and custom implementations were falling behind (especially the commonly used cmd.run state).As this adjusts some specific state behavior, review is encouraged.
states.cmd
Done
Included unique
creates
feature. Shorthand for unless:test -f <filename>
or list of names.PR implements
creates
as a top level state requisite and remove special mod_run_check from cmd. (Left undocumented as the few states using it have mention it individually)states.docker_container
Done
Also supported unless, onlyif, and creates.
Removes special mod_run_check in favor of global creates.
states.git
Done
I might have missed something, but this didn't appear to implement anything other than unless and onlyif. Removed special mod_run_check.
states.macpackage
Allows passing user runas to onlyif and unless command. Kept the unique implementation.See comment Consolidate some state requisites #55974 (comment)
I think the macpackage implementation is broken and should be removed along with the local references to unless, onlyif, and user.
states.file
Runs command specified incheck_cmd
but also allows for additionaltmp_dir
andtmp_ext
. Kept the unique implementation.Nope, file just has a mod_run_check_cmd
What issues does this PR fix or reference?
Fixes: #55938
#51846 (comment)
Fixes: #56329
Previous Behavior
Unique implementations of onlyif and unless act differently for different states
New Behavior
cmd, docker_container, and git state behavior is now more consistent.
Tests written?
Yes - with high likelihood others need adjustment
Commits signed with GPG?
No
@waynew @max-arnold thoughts?