mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge pull request #45277 from rallytime/bp-45025
Back-port #45025 to 2017.7
This commit is contained in:
commit
f09d0e5fdb
@ -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):
|
||||
|
@ -126,7 +126,7 @@ class PillarTestCase(TestCase):
|
||||
]
|
||||
self.assertEqual(
|
||||
pillar.render_pillar({'base': ['foo.sls']}),
|
||||
({'foo': 'bar2'}, [])
|
||||
({'foo': 'bar'}, [])
|
||||
)
|
||||
|
||||
# Test includes using empty key directive
|
||||
@ -136,7 +136,7 @@ class PillarTestCase(TestCase):
|
||||
]
|
||||
self.assertEqual(
|
||||
pillar.render_pillar({'base': ['foo.sls']}),
|
||||
({'foo': 'bar2'}, [])
|
||||
({'foo': 'bar'}, [])
|
||||
)
|
||||
|
||||
# Test includes using simple non-nested key
|
||||
|
Loading…
Reference in New Issue
Block a user