From 2a8ce0d0656f47331a164163f9e3b302de4d3c88 Mon Sep 17 00:00:00 2001 From: Thomas Herve Date: Tue, 3 Oct 2017 16:10:29 +0200 Subject: Don't override sections in deep_update When you comment all the elements in a YAML mapping, you end up with None instead of an empty mapping, which can have bad side effect when handling multiple environemnents. Let's handle that by ignoring the latest None value. Change-Id: I77ffabeb8d4cd2886ef4f41351e42ebe487b5d4b --- heatclient/common/template_utils.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'heatclient/common') diff --git a/heatclient/common/template_utils.py b/heatclient/common/template_utils.py index 9e9c85b..b38710b 100644 --- a/heatclient/common/template_utils.py +++ b/heatclient/common/template_utils.py @@ -198,6 +198,9 @@ def deep_update(old, new): if isinstance(v, collections.Mapping): r = deep_update(old.get(k, {}), v) old[k] = r + elif v is None and isinstance(old.get(k), collections.Mapping): + # Don't override empty data, to work around yaml syntax issue + pass else: old[k] = new[k] return old -- cgit v1.2.1