The orchestrate runner falsely reports "States ran successfully." (likely due to missing reply or timeout from minion).
The following steps was reproduced on Fedora 20 but can be similarly done on any other OS.
Setup
Create a simple state file which installs any uninstalled package (here: bind):
# path: /srv/salt/deleteme.sls
install_dns_server:
pkg.installed:
- name: bind
Use this state in orchestration:
# path: /srv/salt/deleteme_orchestration.sls
install_dns_server_with_orchestration:
salt.state:
- tgt: 'minion_id'
- sls: deleteme
Now make sure that yum somehow fails to install any package. For example, you may set wrong DNS in /etc/resolv.conf or add a non-existing proxy to /etc/yum.conf like here:
# Proxy settings
proxy=http://whatever:8000/
proxy_username=whatever
proxy_password=whatever
Try running yum install bind manually to confirm it fails.
Problem
Run orchestrate runner:
salt-run -l debug state.orchestrate deleteme_orchestration > results.yaml
The debug output does not produce any [ERROR ].
Check results:
# results.yaml
control:
----------
ID: install_dns_server_with_orchestration
Function: salt.state
Result: True
Comment: States ran successfully.
Changes:
Summary
------------
Succeeded: 1
Failed: 0
------------
Total: 1
This is clearly _false_ because:
rpm -qi bind
package bind is not installed
Moreover, running the initial state using salt-call fails perfectly:
salt-call -l debug state.sls deleteme > results.yaml
...
[INFO ] Executing command 'repoquery --queryformat="%{NAME}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-%{REPOID}" --all --pkgnarrow=installed' in directory '/root'
[ERROR ] The following packages failed to install/update: bind.
...
Check results:
# results.yaml
local:
----------
ID: install_dns_server
Function: pkg.installed
Name: bind
Result: False
Comment: The following packages failed to install/update: bind.
Changes:
Summary
------------
Succeeded: 0
Failed: 1
------------
Total: 1
Versions
Both master and minion are deployed on the same Fedora 20 x86_64 host.
salt --versions-report
Salt: 2014.1.4
Python: 2.7.5 (default, Feb 19 2014, 13:47:28)
Jinja2: 2.7.1
M2Crypto: 0.21.1
msgpack-python: 0.1.13
msgpack-pure: Not Installed
pycrypto: 2.6.1
PyYAML: 3.10
PyZMQ: 13.0.2
ZMQ: 3.2.4
Would you mind testing this on the develop version? The orchestrate runner (and the associated saltmod states) have had many improvements in the develop version, and not all have been backported.
I tested it on the same host where it fails using develop branch and it works. And here is the catch: it actually works on another host with exactly the same --versions-report. Two hosts: same OS, same Salt, same states. One repeatedly fails, another repeatedly succeeds using default RPM. No prove, but it may be related to how Salt handles some special cases (or yum does not return failure under certain conditions).
Is there a link to some sort of the timeline for any new Salt release? I would like to re-test it where it fails after update to new package.
Very strange.
The next feature release should go into "release candidate" mode in the next couple of weeks.
seeing the same issue with regard to minions not returning. if a minion or minions fail to respond, the state is marked as successfull
@dstokes I think this is fixed in the develop branch, as well as the 2014.7 branch. Any chance you can test one of those places to verify?
@basepi i was seeing the error on 2014.7 if memory servers, but let me see if i can verify..
I will say, it's confusing right now because 2014.1.7 is the currently-released version of salt, and 2014.7.0 is the upcoming feature release. Too many 7s. =)
i'm seeing this issue in 2014.7.0rc1 as well. the issue is easily reproducible by using targets in your states that don't match any minions. not sure if "success" is the intended functionality there, but it also seems to happen when minions fail to respond in the timeout.
Thanks for the update. We definitely need to get that fixed.
In my view, this issue is related to @dstokes comments:
- No response from minion (timeout).
- Targets which do not match any minion (again "no response" but reason is different).
The first one makes sense explaining my case especially because subsequent re-tests reported by me above "magically" start working again (no timeouts anymore).
However, yesterday I filed another problem (#18413) where quick shell commands (rm, echo, etc.) return nothing and always "successful". Such commands are not expected to cause minion delays. I don't know whether missing minion reply (not sent or not received) is the problem in both of these issues, but I would like to treat these two issues separately. So, I adjusted the title.
I believe I am getting the same issue. Orchestration works cool on LAN. On a very flaky connection, I'm getting "Result: Success" when obviously NO state updates have been made. The only way to check for this is to examine command output manually and doing things manually seems wrong in the first place.
I think it would be easier to reproduce this issue with a simulated slow & flaky link. Perhaps there's some ZMQ things going on, like a timeout not being handled on the saltstack side.
I'm adding adding this link to the post in salt-users as a reverse pointer. I believe this is a fundamental issue with non-returning minions - non-returns are OK when they are rather not.
Orchestration should treat not returning as a failure. This is something we definitely want to fix.
Does passing expect_minions: True in your salt.state call do what you expect?
ex:
test_fail_state_orch:
salt.state:
- tgt: 'silver'
- sls: issue_13216
- expect_minions: True
I think we may simply wish to explore the possibility that we should change this default and/or document this more heavily.
Not quite.
For badly written state like below, I get result: True.
update_test_release:
salt.function:
- name: cmd.script
- tgt: master.local
- arg:
- name: salt://django_bpp/release/files/update_test_release.sh
- expect_minions: True
And here's the result of the state ran:
master.local_master:
ID: update_test_release
Function: salt.function
Name: cmd.script
Result: True
Comment: Function ran successfully. Function cmd.script ran on
master.local. Started: 05:18:07.814691 Duration: 186.718 ms Changes: master.local: The minion function caused an exception: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 1022, in _thread_return return_data = func(_args, *_kwargs) File "/usr/lib/python2.7/dist-packages/salt/modules/cmdmod.py", line 1080, in script path = salt.utils.mkstemp(dir=cwd, suffix=os.path.splitext(source)[1]) File "/usr/lib/python2.7/posixpath.py", line 105, in splitext return genericpath._splitext(p, sep, altsep, extsep) File "/usr/lib/python2.7/genericpath.py", line 91, in _splitext sepIndex = p.rfind(sep) AttributeError: 'dict' object has no attribute 'rfind'
2015-02-05 19:38 GMT+01:00 Mike Place [email protected]:
Does passing expect_minions: True in your salt.state call do what you expect?
ex:
test_fail_state_orch: salt.state: - tgt: 'silver' - sls: issue_13216 - expect_minions: True
I think we may simply wish to explore the possibility that we should change this default and/or document this more heavily.
— Reply to this email directly or view it on GitHub https://github.com/saltstack/salt/issues/13216#issuecomment-73100904.
Pozdrawiam, Michał Pasternak 📱 +48 793 66 87 33
I think it may also be related to the fact that regular salt command does not consider non-returning minion as an error (issue #16443) for CLI exit code - just tested for 2014.7.2.
Actually the fact of totally liberal exit code treatment is the sole reason I am migrating to some other solutions. 18 mar 2015 08:18 "Alexey Pakseykin" [email protected] napisał(a):
I think it may also be related to the fact that regular salt command does not consider non-returning minion as an error (issue #16443 https://github.com/saltstack/salt/issues/16443) for CLI exit code - just tested https://github.com/saltstack/salt/issues/16443#issuecomment-82724469 for 2014.7.2.
— Reply to this email directly or view it on GitHub https://github.com/saltstack/salt/issues/13216#issuecomment-82788764.
Any news on this issue ?
I'm willing to try any fix or workaround you may have as this issue is really affecting my daily deployments...
No news, but I put it on the milestone for our next feature release so we can get some eyes on it and make a decision. In 2015.2 we changed the salt outputter to show minions which didn't return by default, so I think the pattern is swinging in the direction of "minions which didn't return are treated as an error".
It should probably be configurable, as well.
I am getting the same problem with the orchestrate runner when timeouts occur with long running formulas and with minions not responding with version Beryllium 2015.8.1. Any ideas when it will be fixed?