From db31732137869c935629954bca84145734b00887 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Thu, 31 Mar 2016 17:31:32 -0500 Subject: [PATCH] use dictupdate.merge instead of dict.update to merge CLI pillar overrides Fixes #18429. --- salt/pillar/__init__.py | 16 +++++++++++++++- salt/state.py | 2 -- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/salt/pillar/__init__.py b/salt/pillar/__init__.py index 567c06aae4..46493aa26a 100644 --- a/salt/pillar/__init__.py +++ b/salt/pillar/__init__.py @@ -723,7 +723,13 @@ class Pillar(object): 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') @@ -802,6 +808,14 @@ class Pillar(object): 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 diff --git a/salt/state.py b/salt/state.py index 4d5f848966..630dc5e85e 100644 --- a/salt/state.py +++ b/salt/state.py @@ -649,8 +649,6 @@ class State(object): 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):