You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd.run_all with --batch and --failhard gives no output on failure #32452
Corerelates to code central or existential to SaltP2Priority 2bugbroken, incorrect, or confusing behaviorfixed-pls-verifyfix is linked, bug author to confirm fixseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around
When using cmd.run_all with --batch and --failhard, if a failure occurs the output from that minion is not displayed.
Expected:
$ sudo salt --batch=1 --failhard 'minion*' cmd.run_all 'not_a_command'
Executing run on ['minion2']
minion2:
----------
pid:
11525
retcode:
127
stderr:
/bin/sh: 1: not_a_command: not found
stdout:
ERROR: Minions returned with non-zero exit code
Got:
$ sudo salt --batch=1 --failhard 'minion*' cmd.run_all 'not_a_command'
Executing run on ['minion1']
ERROR: Minions returned with non-zero exit code
$ sudo salt --versions-report
Salt Version:
Salt: 2015.8.8.2
Dependency Versions:
Jinja2: 2.7.3
M2Crypto: Not Installed
Mako: Not Installed
PyYAML: 3.11
PyZMQ: 14.4.0
Python: 2.7.9 (default, Mar 1 2015, 12:57:24)
RAET: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
cffi: 0.8.6
cherrypy: Not Installed
dateutil: 2.2
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
libgit2: Not Installed
libnacl: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.2
mysql-python: 1.2.3
pycparser: 2.10
pycrypto: 2.6.1
pygit2: Not Installed
python-gnupg: 0.3.6
smmap: 0.8.2
timelib: Not Installed
System Versions:
dist: debian 8.4
machine: x86_64
release: 3.16.0-4-amd64
system: debian 8.4
I am trying to build a deployment system using salt, and I need to run commands on minions in series, and fail fast.
I was hoping to use cmd.run but #24996
Then I found cmd.run_all but then I found this issue.
@nicholascapo I have fixed this issue with PR #33050. This fix will display a data dictionary with the ret of the command that failed, like so:
root@rallytime:~# salt rallytime cmd.run_all 'foo' -b 1 --failhard
Executing run on ['rallytime']
{'rallytime': {'retcode': 127, 'ret': {'pid': 5838, 'retcode': 127, 'stderr': '/bin/bash: foo: command not found', 'stdout': ''}}}
ERROR: Minions returned with non-zero exit code.
Because the batch system doesn't have it's own outputter, we must write the error here in this manor.
I have also fixed #24996 to make sure cmd.run with --batch and --failhard actually recognize failing commands and failhard. With both of these commands combined, the expected output for a cmd.run call looks like this now:
root@rallytime:~# salt rallytime cmd.run 'foo' -b 1 --failhard
Executing run on ['rallytime']
{'rallytime': {'retcode': 127, 'ret': '/bin/bash: foo: command not found'}}
ERROR: Minions returned with non-zero exit code.
Corerelates to code central or existential to SaltP2Priority 2bugbroken, incorrect, or confusing behaviorfixed-pls-verifyfix is linked, bug author to confirm fixseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around
Activity
nicholascapo commentedon Apr 8, 2016
I am trying to build a deployment system using salt, and I need to run commands on minions in series, and fail fast.
I was hoping to use
cmd.runbut #24996Then I found
cmd.run_allbut then I found this issue.jfindlay commentedon Apr 11, 2016
@nicholascapo, thanks for reporting.
Display command output when command fails with batch + failhard options
rallytime commentedon May 4, 2016
@nicholascapo I have fixed this issue with PR #33050. This fix will display a data dictionary with the ret of the command that failed, like so:
Because the batch system doesn't have it's own outputter, we must write the error here in this manor.
I have also fixed #24996 to make sure
cmd.runwith--batchand--failhardactually recognize failing commands and failhard. With both of these commands combined, the expected output for a cmd.run call looks like this now:Display command output when command fails with batch + failhard optio…
nicholascapo commentedon Jun 7, 2016
@rallytime Sorry for the delay, I can confirm this is fixed in version
2015.8.10Thanks