mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #39641 from smarsching/issue-39169-2016.3
Return runner return code in a way compatible with check_state_result
This commit is contained in:
commit
f7389bf1f5
2 changed files with 11 additions and 3 deletions
|
@ -39,7 +39,15 @@ class SaltRun(parsers.SaltRunOptionParser):
|
|||
pr = activate_profile(profiling_enabled)
|
||||
try:
|
||||
ret = runner.run()
|
||||
if isinstance(ret, dict) and 'retcode' in ret.get('data', {}):
|
||||
# In older versions ret['data']['retcode'] was used
|
||||
# for signaling the return code. This has been
|
||||
# changed for the orchestrate runner, but external
|
||||
# runners might still use it. For this reason, we
|
||||
# also check ret['data']['retcode'] if
|
||||
# ret['retcode'] is not available.
|
||||
if isinstance(ret, dict) and 'retcode' in ret:
|
||||
self.exit(ret['retcode'])
|
||||
elif isinstance(ret, dict) and 'retcode' in ret.get('data', {}):
|
||||
self.exit(ret['data']['retcode'])
|
||||
finally:
|
||||
output_profile(
|
||||
|
|
|
@ -57,9 +57,9 @@ def orchestrate(mods, saltenv='base', test=None, exclude=None, pillar=None):
|
|||
ret = {'data': {minion.opts['id']: running}, 'outputter': 'highstate'}
|
||||
res = salt.utils.check_state_result(ret['data'])
|
||||
if res:
|
||||
ret['data']['retcode'] = 0
|
||||
ret['retcode'] = 0
|
||||
else:
|
||||
ret['data']['retcode'] = 1
|
||||
ret['retcode'] = 1
|
||||
return ret
|
||||
|
||||
# Aliases for orchestrate runner
|
||||
|
|
Loading…
Add table
Reference in a new issue