Append empty dictionaries for saltenvs with no top file

Rather than excluding them from the get_tops() return data at all, just
populate them with empty dictionaries. This makes it easier to unit test
things like merge order, while still being functionally the same as
exlcluding the saltenv from get_tops() altogether.
This commit is contained in:
Erik Johnson 2016-06-01 17:31:29 -05:00
parent 5eb1b3ca62
commit 9da40c4437

View File

@ -2407,6 +2407,8 @@ class BaseHighState(object):
saltenv=self.opts['environment']
)
]
else:
tops[self.opts['environment']] = [{}]
elif self.opts['top_file_merging_strategy'] == 'merge':
found = 0
if self.opts.get('state_top_saltenv', False):
@ -2426,6 +2428,7 @@ class BaseHighState(object):
)
)
else:
tops[saltenv].append({})
log.debug('No contents loaded for env: {0}'.format(saltenv))
else:
for saltenv in self._get_envs():
@ -2444,6 +2447,7 @@ class BaseHighState(object):
)
)
else:
tops[saltenv].append({})
log.debug('No contents loaded for env: {0}'.format(saltenv))
if found > 1:
log.warning('Top file merge strategy set to \'merge\' and multiple top files found. '