Merge pull request #31358 from Ashald/bugfix/state-sls-environment

Make sure state.sls preserves saltenv/pillarenv
This commit is contained in:
Mike Place 2016-02-23 10:54:04 -07:00
commit abb4539dc8

View File

@ -712,15 +712,12 @@ def sls(mods,
saltenv = __opts__['environment'] saltenv = __opts__['environment']
else: else:
saltenv = 'base' saltenv = 'base'
else:
__opts__['environment'] = saltenv
if not pillarenv: if not pillarenv:
if __opts__.get('pillarenv', None): if __opts__.get('pillarenv', None):
pillarenv = __opts__['pillarenv'] pillarenv = __opts__['pillarenv']
else:
__opts__['pillarenv'] = pillarenv
# Modification to __opts__ lost after this if-else
if queue: if queue:
_wait(kwargs.get('__pub_jid')) _wait(kwargs.get('__pub_jid'))
else: else:
@ -729,6 +726,10 @@ def sls(mods,
__context__['retcode'] = 1 __context__['retcode'] = 1
return conflict return conflict
# Ensure desired environment
__opts__['environment'] = saltenv
__opts__['pillarenv'] = pillarenv
if isinstance(mods, list): if isinstance(mods, list):
disabled = _disabled(mods) disabled = _disabled(mods)
else: else: