mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge pull request #25588 from basepi/salt.ssh.retcode.25401
Fix some of the retcode work from #23105
This commit is contained in:
commit
12b8fd05d0
@ -533,8 +533,12 @@ class SSH(object):
|
||||
final_exit = 0
|
||||
for ret in self.handle_ssh():
|
||||
host = next(six.iterkeys(ret))
|
||||
host_ret = ret[host].get('retcode', 0)
|
||||
if host_ret != 0:
|
||||
if isinstance(ret[host], dict):
|
||||
host_ret = ret[host].get('retcode', 0)
|
||||
if host_ret != 0:
|
||||
final_exit = 1
|
||||
else:
|
||||
# Error on host
|
||||
final_exit = 1
|
||||
|
||||
self.cache_job(jid, host, ret[host], fun)
|
||||
@ -778,11 +782,13 @@ class Single(object):
|
||||
opts_pkg['_caller_cachedir'] = self.opts['cachedir']
|
||||
# Use the ID defined in the roster file
|
||||
opts_pkg['id'] = self.id
|
||||
retcode = opts_pkg['retcode']
|
||||
|
||||
retcode = 0
|
||||
|
||||
if '_error' in opts_pkg:
|
||||
# Refresh failed
|
||||
ret = json.dumps({'local': opts_pkg})
|
||||
retcode = opts_pkg['retcode']
|
||||
return ret, retcode
|
||||
|
||||
pillar = salt.pillar.Pillar(
|
||||
@ -853,8 +859,10 @@ class Single(object):
|
||||
result = self.wfuncs[self.fun](*self.args, **self.kwargs)
|
||||
except TypeError as exc:
|
||||
result = 'TypeError encountered executing {0}: {1}'.format(self.fun, exc)
|
||||
retcode = 1
|
||||
except Exception as exc:
|
||||
result = 'An Exception occurred while executing {0}: {1}'.format(self.fun, exc)
|
||||
retcode = 1
|
||||
# Mimic the json data-structure that "salt-call --local" will
|
||||
# emit (as seen in ssh_py_shim.py)
|
||||
if isinstance(result, dict) and 'local' in result:
|
||||
|
@ -125,7 +125,6 @@ class FunctionWrapper(object):
|
||||
if len(ret) < 2 and 'local' in ret:
|
||||
ret = ret['local']
|
||||
ret = ret.get('return', {})
|
||||
ret.update({'retcode': retcode})
|
||||
except ValueError:
|
||||
ret = {'_error': 'Failed to return clean data',
|
||||
'stderr': stderr,
|
||||
|
Loading…
Reference in New Issue
Block a user