mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Fixing retcode for normal run with no errors
This commit is contained in:
parent
041bdbff18
commit
d02d36525e
@ -766,11 +766,11 @@ 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']
|
||||
|
||||
if '_error' in opts_pkg:
|
||||
# Refresh failed
|
||||
ret = json.dumps({'local': opts_pkg})
|
||||
retcode = opts_pkg['retcode']
|
||||
return ret, retcode
|
||||
|
||||
pillar = salt.pillar.Pillar(
|
||||
@ -848,7 +848,7 @@ class Single(object):
|
||||
ret = json.dumps({'local': result['local']})
|
||||
else:
|
||||
ret = json.dumps({'local': {'return': result}})
|
||||
return ret
|
||||
return ret, retcode
|
||||
|
||||
def _cmd_str(self):
|
||||
'''
|
||||
|
@ -114,12 +114,14 @@ class FunctionWrapper(object):
|
||||
if stderr.count('Permission Denied'):
|
||||
return {'_error': 'Permission Denied',
|
||||
'stdout': stdout,
|
||||
'stderr': stderr}
|
||||
'stderr': stderr
|
||||
'retcode': retcode}
|
||||
try:
|
||||
ret = json.loads(stdout, object_hook=salt.utils.decode_dict)
|
||||
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