Ignore top-level merge items which evaluate False
There has been recent tripleo regressions caused by heat setting empty config as '' rather than {} which cause os-apply-config to error on merge_configs. This change ignores any top-level config which evaluates to False, ignoring possible empty data including '', {}, None, [] An os-apply-config release with this fix would likely allow the current heat pin to be removed Id134664a5df7232da0fb5d9ed62b82e12b3d54a8 Change-Id: Ia5bd99d1550f43760c064b769be3be46b3417331 Closes-Bug: #1426116 Related-Bug: #1425238
This commit is contained in:
parent
9d70d50ff3
commit
94f9819c67
@ -58,7 +58,8 @@ def merge_configs(parsed_configs):
|
|||||||
'''Returns deep-merged dict from passed list of dicts.'''
|
'''Returns deep-merged dict from passed list of dicts.'''
|
||||||
final_conf = {}
|
final_conf = {}
|
||||||
for conf in parsed_configs:
|
for conf in parsed_configs:
|
||||||
final_conf = _deep_merge_dict(final_conf, conf)
|
if conf:
|
||||||
|
final_conf = _deep_merge_dict(final_conf, conf)
|
||||||
return final_conf
|
return final_conf
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,3 +114,8 @@ class TestMergeConfigs(testtools.TestCase):
|
|||||||
{'a': [4, 5, 6]}]
|
{'a': [4, 5, 6]}]
|
||||||
result = collect_config.merge_configs(list_conflict)
|
result = collect_config.merge_configs(list_conflict)
|
||||||
self.assertEqual({'a': [4, 5, 6]}, result)
|
self.assertEqual({'a': [4, 5, 6]}, result)
|
||||||
|
|
||||||
|
def test_merge_configs_empty_notdict(self):
|
||||||
|
list_conflict = [[], {'a': '1'}, '', None, {'b': '2'}, {}]
|
||||||
|
result = collect_config.merge_configs(list_conflict)
|
||||||
|
self.assertEqual({'a': '1', 'b': '2'}, result)
|
||||||
|
Loading…
Reference in New Issue
Block a user