Merge pull request #30978 from garethgreenaway/30472_state_functions_no_default_retcode

fixes to state.py in 2015.8
This commit is contained in:
Mike Place 2016-02-08 11:49:05 -07:00
commit de215bd0cd

View file

@ -70,6 +70,10 @@ def _set_retcode(ret):
'''
Set the return code based on the data back from the state system
'''
# Set default retcode to 0
__context__['retcode'] = 0
if isinstance(ret, list):
__context__['retcode'] = 1
return
@ -576,7 +580,6 @@ def highstate(test=None,
serial = salt.payload.Serial(__opts__)
cache_file = os.path.join(__opts__['cachedir'], 'highstate.p')
_set_retcode(ret)
# Work around Windows multiprocessing bug, set __opts__['test'] back to
# value from before this function was run.
@ -770,7 +773,6 @@ def sls(mods,
except (IOError, OSError):
msg = 'Unable to write to SLS cache file {0}. Check permission.'
log.error(msg.format(cache_file))
_set_retcode(ret)
# Work around Windows multiprocessing bug, set __opts__['test'] back to
# value from before this function was run.
@ -876,8 +878,7 @@ def show_highstate(queue=False, **kwargs):
ret = st_.compile_highstate()
finally:
st_.pop_active()
if isinstance(ret, list):
__context__['retcode'] = 1
_set_retcode(ret)
return ret