diff options
author | Thomas Herve <therve@redhat.com> | 2017-10-03 16:10:29 +0200 |
---|---|---|
committer | Thomas Herve <therve@redhat.com> | 2017-10-05 10:56:10 +0200 |
commit | 2a8ce0d0656f47331a164163f9e3b302de4d3c88 (patch) | |
tree | f0e76c0572ba1ca7e11feacb2553db641519c55b /heatclient/common | |
parent | bfa77b57c682005ec4c5fd28e02042d2130ed703 (diff) | |
download | python-heatclient-2a8ce0d0656f47331a164163f9e3b302de4d3c88.tar.gz |
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
Diffstat (limited to 'heatclient/common')
-rw-r--r-- | heatclient/common/template_utils.py | 3 |
1 files changed, 3 insertions, 0 deletions
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 |