mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
show check_cmd output on failure
This commit is contained in:
parent
cfe39df7ac
commit
90b01e9e0d
1 changed files with 12 additions and 4 deletions
|
@ -4569,10 +4569,18 @@ def mod_run_check_cmd(cmd, filename, **check_cmd_opts):
|
|||
|
||||
log.debug('running our check_cmd')
|
||||
_cmd = '{0} {1}'.format(cmd, filename)
|
||||
if __salt__['cmd.retcode'](_cmd, **check_cmd_opts) != 0:
|
||||
return {'comment': 'check_cmd execution failed',
|
||||
'skip_watch': True,
|
||||
'result': False}
|
||||
cret = __salt__['cmd.run_all'](_cmd, **check_cmd_opts)
|
||||
if cret['retcode'] != 0:
|
||||
ret = {'comment': 'check_cmd execution failed',
|
||||
'skip_watch': True,
|
||||
'result': False}
|
||||
|
||||
if cret.get('stdout'):
|
||||
ret['comment'] += '\n' + cret['stdout']
|
||||
if cret.get('stderr'):
|
||||
ret['comment'] += '\n' + cret['stderr']
|
||||
|
||||
return ret
|
||||
|
||||
# No reason to stop, return True
|
||||
return True
|
||||
|
|
Loading…
Add table
Reference in a new issue