Skip to content

Commit

Permalink
Merge pull request #32288 from terminalmage/issue18429
Browse files Browse the repository at this point in the history
use dictupdate.merge instead of dict.update to merge CLI pillar overrides
  • Loading branch information
Nicole Thomas committed Apr 1, 2016
2 parents 3e374e7 + db31732 commit 42a25f6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 15 additions & 1 deletion salt/pillar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,13 @@ def ext_pillar(self, pillar, pillar_dirs, errors=None):
return pillar, errors
ext = None
# Bring in CLI pillar data
pillar.update(self.pillar_override)
if self.pillar_override and isinstance(self.pillar_override, dict):
pillar = merge(pillar,
self.pillar_override,
self.merge_strategy,
self.opts.get('renderer', 'yaml'),
self.opts.get('pillar_merge_lists', False))

for run in self.opts['ext_pillar']:
if not isinstance(run, dict):
errors.append('The "ext_pillar" option is malformed')
Expand Down Expand Up @@ -802,6 +808,14 @@ def compile_pillar(self, ext=True, pillar_dirs=None):
for error in errors:
log.critical('Pillar render error: {0}'.format(error))
pillar['_errors'] = errors

if self.pillar_override and isinstance(self.pillar_override, dict):
pillar = merge(pillar,
self.pillar_override,
self.merge_strategy,
self.opts.get('renderer', 'yaml'),
self.opts.get('pillar_merge_lists', False))

return pillar


Expand Down
2 changes: 0 additions & 2 deletions salt/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,6 @@ def _gather_pillar(self):
pillarenv=self.opts.get('pillarenv')
)
ret = pillar.compile_pillar()
if self._pillar_override and isinstance(self._pillar_override, dict):
ret.update(self._pillar_override)
return ret

def _mod_init(self, low):
Expand Down

0 comments on commit 42a25f6

Please sign in to comment.