mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
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:
parent
5eb1b3ca62
commit
9da40c4437
@ -2407,6 +2407,8 @@ class BaseHighState(object):
|
|||||||
saltenv=self.opts['environment']
|
saltenv=self.opts['environment']
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
else:
|
||||||
|
tops[self.opts['environment']] = [{}]
|
||||||
elif self.opts['top_file_merging_strategy'] == 'merge':
|
elif self.opts['top_file_merging_strategy'] == 'merge':
|
||||||
found = 0
|
found = 0
|
||||||
if self.opts.get('state_top_saltenv', False):
|
if self.opts.get('state_top_saltenv', False):
|
||||||
@ -2426,6 +2428,7 @@ class BaseHighState(object):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
tops[saltenv].append({})
|
||||||
log.debug('No contents loaded for env: {0}'.format(saltenv))
|
log.debug('No contents loaded for env: {0}'.format(saltenv))
|
||||||
else:
|
else:
|
||||||
for saltenv in self._get_envs():
|
for saltenv in self._get_envs():
|
||||||
@ -2444,6 +2447,7 @@ class BaseHighState(object):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
tops[saltenv].append({})
|
||||||
log.debug('No contents loaded for env: {0}'.format(saltenv))
|
log.debug('No contents loaded for env: {0}'.format(saltenv))
|
||||||
if found > 1:
|
if found > 1:
|
||||||
log.warning('Top file merge strategy set to \'merge\' and multiple top files found. '
|
log.warning('Top file merge strategy set to \'merge\' and multiple top files found. '
|
||||||
|
Loading…
Reference in New Issue
Block a user