Merge pull request #43854 from keesbos/2017.7

Map __env__ in git_pillar before sanity checks
This commit is contained in:
Nicole Thomas 2017-10-02 16:44:52 -04:00 committed by GitHub
commit 36b0b1174b

View file

@ -566,8 +566,15 @@ def ext_pillar(minion_id, repo, pillar_dirs):
False
)
for pillar_dir, env in six.iteritems(pillar.pillar_dirs):
# Map env if env == '__env__' before checking the env value
if env == '__env__':
env = opts.get('pillarenv') \
or opts.get('environment') \
or opts.get('git_pillar_base')
log.debug('__env__ maps to %s', env)
# If pillarenv is set, only grab pillars with that match pillarenv
if opts['pillarenv'] and env != opts['pillarenv'] and env != '__env__':
if opts['pillarenv'] and env != opts['pillarenv']:
log.debug(
'env \'%s\' for pillar dir \'%s\' does not match '
'pillarenv \'%s\', skipping',
@ -586,12 +593,6 @@ def ext_pillar(minion_id, repo, pillar_dirs):
'env \'%s\'', pillar_dir, env
)
if env == '__env__':
env = opts.get('pillarenv') \
or opts.get('environment') \
or opts.get('git_pillar_base')
log.debug('__env__ maps to %s', env)
pillar_roots = [pillar_dir]
if __opts__['git_pillar_includes']: