diff --git a/salt/modules/state.py b/salt/modules/state.py index fee4524a7c..c9116b2d75 100644 --- a/salt/modules/state.py +++ b/salt/modules/state.py @@ -700,11 +700,13 @@ def sls(mods, except NameError: st_ = salt.state.HighState(opts, pillar, kwargs.get('__pub_jid')) + umask = os.umask(0o77) if kwargs.get('cache'): if os.path.isfile(cfn): with salt.utils.fopen(cfn, 'rb') as fp_: high_ = serial.load(fp_) return st_.state.call_high(high_) + os.umask(umask) if isinstance(mods, six.string_types): mods = mods.split(',') @@ -741,11 +743,11 @@ def sls(mods, msg = 'Unable to write to SLS cache file {0}. Check permission.' log.error(msg.format(cache_file)) - os.umask(cumask) _set_retcode(ret) # Work around Windows multiprocessing bug, set __opts__['test'] back to # value from before this function was run. __opts__['test'] = orig_test + try: with salt.utils.fopen(cfn, 'w+b') as fp_: try: @@ -756,6 +758,7 @@ def sls(mods, except (IOError, OSError): msg = 'Unable to write to highstate cache file {0}. Do you have permissions?' log.error(msg.format(cfn)) + os.umask(cumask) return ret