As discussed here it seems there is some inconsistencies with salt-ssh and salt.test.exception.
So maybe I am not testing this correctly. But i have a state test.sls like:
group-users:
group.present:
- gid: |
{{ salt.test.exception("/path/that/must/exist does not exist!!") }}
I call:
salt-ssh '*' state.show_sls test
And I get:
testserver:
----------
group-users:
----------
__env__:
base
__sls__:
test
group:
|_
----------
gid:
{'retcode': 0, '_error': 'Failed to return clean data', 'stderr': 'Traceback (most recent call last):\n File "/var/tmp/.mitar_cb9e2b_salt/salt-call", line 15, in <module>\n salt_call()\n File "/var/tmp/.mitar_cb9e2b_salt/py2/salt/scripts.py", line 379, in salt_call\n client.run()\n File "/var/tmp/.mitar_cb9e2b_salt/py2/salt/cli/call.py", line 58, in run\n caller.run()\n File "/var/tmp/.mitar_cb9e2b_salt/py2/salt/cli/caller.py", line 134, in run\n ret = self.call()\n File "/var/tmp/.mitar_cb9e2b_salt/py2/salt/cli/caller.py", line 197, in call\n ret[\'return\'] = func(*args, **kwargs)\n File "/var/tmp/.mitar_cb9e2b_salt/py2/salt/modules/test.py", line 512, in exception\n raise Exception(message)\nException: /path/that/must/exist does not exist!!', 'stdout': ''}
- present
|_
----------
order:
10000
So it did not raise the exception, but convert it to an object with retcode, _error and some other fields.
Salt Version:
Salt: 2016.11.1
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.9.4
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
Python: 2.7.10 (default, Jul 14 2015, 19:46:27)
python-gnupg: 0.3.8
PyYAML: 3.12
PyZMQ: 16.0.2
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.4.2
ZMQ: 4.1.5
System Versions:
dist:
machine: x86_64
release: 14.5.0
system: Darwin
version: 10.10.5 x86_64
cc @whiteinge
Thanks for filing this.
For comparison with a master/minion setup: if a traceback occurs during the Jinja phase the entire state run fails and a list is returned containing the error. This is consistent with tracebacks elsewhere during the state run and salt-ssh should mirror this same behavior.
% salt '*' state.show_sls error
jerry:
- Rendering SLS 'base:error' failed: Jinja error: /path/that/must/exist does not exist!!
[...snip traceback here...]
Thanks for reporting this.
Looks like salt-ssh is missing the _error entry for some reason, and just needs to be displayed.
Thanks
Daniel
_error is in the value returned, as you see above in the example. But it does not trigger the failure of the state rendering.
Right, that is what i was saying, salt-ssh is missing the _error key in the dictionary and not changing the output based on it.
_error is for Pillar generation. This should fail the entire run and return a single-item list containing a string of the traceback in order to be compatible with non-SSH Salt returns.
This holds also for any other exception being raised. It simply looks they d not stop rendering but are converted to values. This is not good. This can hide errors.
@saltstack/team-core anyone know anything about how salt-ssh handles displaying command output, and checking for the _error keys for pillar rendering?
Thanks,
Daniel
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
Still relevant.
Thank you for updating this issue. It is no longer marked as stale.
Most helpful comment
@saltstack/team-core anyone know anything about how salt-ssh handles displaying command output, and checking for the
_errorkeys for pillar rendering?Thanks,
Daniel