Fixing retcode for normal run with no errors

This commit is contained in:
Nathan Grennan 2015-05-05 14:00:53 -07:00
parent 041bdbff18
commit d02d36525e
2 changed files with 5 additions and 3 deletions

View File

@ -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):
'''

View File

@ -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,