-
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
Using batch-mode with salt.state
in orchestration runner considers all minions to have failed
#39169
Comments
@Ch3LL |
@blueyed thanks for clarifying. Seems you have a patch in mind, want to submit that as a PR? |
@Ch3LL |
I run into this problem as well |
I am also affected by this problem. The question regarding this issue is how the API for states is defined:
I suspect that answer two is the correct one, but I do not have a sufficient understanding of Salt's internals to be sure. Maybe one of the core developers can comment. I would be happy to provide a pull request with the necessary changes once this question is answered. |
I found the relevant change in @isbm made this change, so maybe he can shed light on why this change was introduced and how we could fix the issues resulting from this change. |
@smarsching You are asking me to un-swap a magnetic tar tape from my brain's archives in order to remember what the heck I have been done a year ago... 😆 OK, the PR was here: #31745 and it self-explanatory there. I guess, this needs to be improved a bit. |
@isbm Yes, I know this was a mean question. I also hate it when I am confronted with some code I wrote a long time ago. 😉 Thank you very much for pointing me to #31745. Now I see that the commit that I found was actually part of a larger changeset. I will try to figure out how the problem with |
After digging deeper into the code, I came to the following conclusion: The The only code that violates this structure is the I will try to put a patch together that implements these fixes. |
Previously, the return code of the runner (if any) was supplied in ret['data']['retcode']. This was problematic if ret['data'] was later processed by check_state_result. With this change, runners return the optional return code in ret['retcode'], like the other code (modules, etc.) already did before.
Can yall test if this PR fixes this issue as well? Thanks, |
Closing since its fixed and haven't heard back from anyone. Please comment and we can re-open if this changes |
This ensures we do not introduce a regression which breaks the usage of the `batch` option when using states in orchestration runners. Related to saltstack#40635 and saltstack#39169
- Use `batch` parameter to process targets sequentially [reference](saltstack/salt#39169)
Description of Issue/Question
When using
batch
withsalt.state
successful/all runs will be handled like failures.This is caused because of
'retcode': 0
inm_ret
being passed tosalt.utils.check_state_result
(insalt/salt/states/saltmod.py
Lines 302 to 306 in 0a8c7e4
Since it's not a dict, it will trigger
ret
to beFalse
(insalt/salt/utils/__init__.py
Lines 1841 to 1842 in 0a8c7e4
Using
m_ret.pop('retcode')
before fixes it.I could imagine also for
check_state_result
to look atretcode
(if any), and use it to return based on that (i.e.0
means success).salt.function
is not affected by this. It looks atretcode
(salt/salt/states/saltmod.py
Lines 474 to 476 in 0a8c7e4
check_state_result
.Setup
stack.sls
:Versions Report
The text was updated successfully, but these errors were encountered: