handle empty sections in environment files
If an environment file has an *empty* section, as in: parameter_defaults: This would ultimately fail in deep_update (in heatclient/common/template_utils.py), which would get called with old == None. This patch handles this situation by explicitly setting old = {} if deep_update is called with old == None. Change-Id: Ia7bee87cdb99e29c63c9dc163f8490fef3f24f24 Closes-bug: 1631408
This commit is contained in:
@@ -188,6 +188,12 @@ def normalise_file_path_to_url(path):
|
||||
|
||||
def deep_update(old, new):
|
||||
'''Merge nested dictionaries.'''
|
||||
|
||||
# Prevents an error if in a previous iteration
|
||||
# old[k] = None but v[k] = {...},
|
||||
if old is None:
|
||||
old = {}
|
||||
|
||||
for k, v in new.items():
|
||||
if isinstance(v, collections.Mapping):
|
||||
r = deep_update(old.get(k, {}), v)
|
||||
|
Reference in New Issue
Block a user