-
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
Add unless/ifonly params to module.run/wait + more granular unless/ifonly result evluation #5050
Comments
Currently my
I will be happy to replace |
I agree, I have approved this for the future, but it should have unless/onlyif for shell commands and executing other modules and checking the module retcode (which will take more work) |
Thanks a lot! |
I don't know yet, probably the options like they are now and then the module_unless and module_onlyif options will be added. |
Okay, thanks. Just opened a new bug report for you... =) So you will have some work either way. |
Any progress on this? It's unfortunate that one has to drop back to |
Having this would be a huge help. I've run into this so many times. Is there a workaround that would allow a conditional execution for module.run? |
Adding my support for this. I'd like to run upstart.restart for a service |
It should be possible to use the templating system to emulate this, right? |
+1 |
I believe I implemented what is requested here. Can someone verify? https://github.com/saltstack/salt/blob/develop/salt/state.py#L601 |
Ah yes, another one that's closed because of your awesome global |
Correct me if I'm wrong (great work @gtmanfred by the way, I've already edited a ton of SLS files to use this), but I believe there's a meta request in the original issue that hasn't yet been addressed, that being the ability to use alternative functions to |
Ah, good point. Reopening. |
|
@FunTimeCoding if it's not working at all, it's possible there's a bug. Please open a separate issue, include the states which are failing (simplified reproduction case if possible), and include the output of |
This still does not work. |
Looks like it works now. The issue can be closed.
|
That is not what it is being talked about. Passing modules to unless and onlyif, instead of just bash commands is the request. |
How far did this get, can modules currently be passed to unless/onlyif? If so, what is the format for this? |
no work has been done on this afaik |
Work done here #51846 |
Salt state scripting will be much more useful if one can use
module.run/wait
states withunless
andifonly
params.The whole idea of salt is the aim not to use console commands in state.
So, the whole internal command stack was developed — called modules.
But why
cmd.run/wait
haveunless/ifonly
andmodule.run/wait
doesn't?..The second idea is to somehow to be able to control what
unless/ifonly
module commands are considered having positive result.I mean for example I want smth like this:
Here
pkg.version
command returns empty string if not installed, this should be consideredFalse
. Any non-empty result should be string.I will be happy if I will be ablo to use more complex logic like
- unless: pkg.available_version mysql-server < 5.5
The text was updated successfully, but these errors were encountered: