fix pillar includes from merging over the current sls defines

ihttps://github.com/saltstack/salt/issues/39860
This commit is contained in:
s8weber 2017-12-14 19:08:30 -05:00 committed by rallytime
parent ff9880c498
commit 1152202fdc
No known key found for this signature in database
GPG key ID: E8F1A4B90D0DEA19

View file

@ -664,6 +664,8 @@ class Pillar(object):
log.error(msg)
errors.append(msg)
else:
# render included state(s)
include_states = []
for sub_sls in state.pop('include'):
if isinstance(sub_sls, dict):
sub_sls, v = next(six.iteritems(sub_sls))
@ -685,16 +687,23 @@ class Pillar(object):
nstate = {
key_fragment: nstate
}
include_states.append(nstate)
if err:
errors += err
if include_states:
# merge included state(s) with the current state merged last
include_states.append(state)
state = None
for s in include_states:
if state is None:
state = s
else:
state = merge(
state,
nstate,
s,
self.merge_strategy,
self.opts.get('renderer', 'yaml'),
self.opts.get('pillar_merge_lists', False))
if err:
errors += err
return state, mods, errors
def render_pillar(self, matches, errors=None):