-
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
--failhard option not working as expected #24996
Comments
@danlsgiga Can you provide the output from |
Sure! Here it goes: |
Just as an update, I made some tests using the batch mode and --failhard with modules and it is working fine, the issue is happening only when using the cmd.run module. So, for example: |
I was reading the salt -d documentation and tried the cmd.run_all module with the -b1 --failhard parameters. So, it turned out that I must use cmd.run_all instead of cmd.run to have the --failhard parameter to be effectively working. Is that on purpose or is it a bug? |
Here are the results for the cmd.run module: salt -b1 --failhard 'minion*' cmd.run 'systemctl restart httpd'Executing run on ['minion3.local.dom'] minion3.local.dom: Executing run on ['minion1.local.dom'] minion1.local.dom: Executing run on ['minion2.local.dom'] minion2.local.dom: |
Here are the results for the cmd.run module: salt -b1 --failhard 'minion*' cmd.run_all 'systemctl restart httpd'Executing run on ['minion3.local.dom'] |
@danlsgiga I'm so sorry for the delay on this, I seem to have not gotten a notification from your updates until today... Let me look into --failhard a little more. I'm leaning towards this being a bug, but I may be missing something about it being expected behavior. |
@jtand No worries... The behaviour I expected on cmd.run using the batch mode and --failhard is working great if I use cmd.run_all. But yeah, it's a good idea to check if cmd.run must behave like that or if it is a bug. I'm also leaning towards this being a bug, because the only specification difference between cmd.run and cmd.run_all should be cmd.run returns data as string and cmd.run_all as a dict. Thanks!! ;) |
@danlsgiga The fix in #33048 should button this up for you. I showed an example of the previous behavior and the new behavior in the pull request. Please give that a try and let me know how it goes. Note that the command doesn't currently give any output about the failure as it stands in that fix. I'm going to address that in a new PR to fix #32452, which is linked above. |
Hey @rallytime, awesome news! Thanks for working on this! |
@danlsgiga Sweeeet! Glad to hear it! :D |
The --failhard parameter for the salt command is supposed to stop batch execution upon first "bad" return. This is not happening even when failhard = True in the master config.
Quick example:
salt -b 1 --failhard 'nginx*' cmd.run 'systemctl restart nginx'
is executing in all targetted systems regardless of the error return code. It should stop the batch execution at the first failed execution.
The text was updated successfully, but these errors were encountered: