summaryrefslogtreecommitdiff
path: root/heatclient/common
diff options
context:
space:
mode:
authorLars Kellogg-Stedman <lars@redhat.com>2016-10-07 11:05:59 -0400
committerLars Kellogg-Stedman <lars@redhat.com>2016-10-07 11:10:29 -0400
commit0d218c92beb8f0fa11a18c2dc56bb92ed7feb785 (patch)
treeeb1b1e56e4702928f8c9e99753df11a446cadc03 /heatclient/common
parent7f0f66e4fe37d5ea56a1dfb2f8ce1363ae7361ac (diff)
downloadpython-heatclient-0d218c92beb8f0fa11a18c2dc56bb92ed7feb785.tar.gz
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
Diffstat (limited to 'heatclient/common')
-rw-r--r--heatclient/common/template_utils.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/heatclient/common/template_utils.py b/heatclient/common/template_utils.py
index 2a6504c..cf28aef 100644
--- a/heatclient/common/template_utils.py
+++ b/heatclient/common/template_utils.py
@@ -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)