mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Allow minion/CLI saltenv/pillarenv to override master when compiling pillar
Because we check in the master opts first, if the environment or pillarenv values are set in the master config file, they will take precedence over the values specified in the minion config (or gathered via the CLI). This commit fixes that ordering such that the values passed to __gen_opts() take precedence over the values from the master config.
This commit is contained in:
parent
1b9217d636
commit
3cb9833e57
1 changed files with 7 additions and 4 deletions
|
@ -372,11 +372,14 @@ class Pillar(object):
|
|||
opts['grains'] = {}
|
||||
else:
|
||||
opts['grains'] = grains
|
||||
if not opts.get('environment'):
|
||||
opts['environment'] = saltenv
|
||||
# Allow minion/CLI saltenv/pillarenv to take precedence over master
|
||||
opts['environment'] = saltenv \
|
||||
if saltenv is not None \
|
||||
else opts.get('environment')
|
||||
opts['pillarenv'] = pillarenv \
|
||||
if pillarenv is not None \
|
||||
else opts.get('pillarenv')
|
||||
opts['id'] = self.minion_id
|
||||
if not opts.get('pillarenv'):
|
||||
opts['pillarenv'] = pillarenv
|
||||
if opts['state_top'].startswith('salt://'):
|
||||
opts['state_top'] = opts['state_top']
|
||||
elif opts['state_top'].startswith('/'):
|
||||
|
|
Loading…
Add table
Reference in a new issue