summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFedor Zhadaev <fzhadaev@mirantis.com>2016-08-10 14:43:04 +0300
committerFedor Zhadaev <fzhadaev@mirantis.com>2016-08-10 14:43:04 +0300
commitfd4977664a2ab2e4be5745fbaf3e3c9f9dca6796 (patch)
tree3a342fc68293f709923bed194b213073b3fdf27c
parentd19c4589554b2d82b6fcb1fe921ffeffd9377a2f (diff)
Fix merge_dicts logic for the case of two nonempty lists
JIRA: FUEL-170 Change-Id: I5abae6fc950cdabe064b5402d9555cedf81cfc23 Signed-off-by: Fedor Zhadaev <fzhadaev@mirantis.com>
-rw-r--r--deploy/deploy-config.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/deploy/deploy-config.py b/deploy/deploy-config.py
index c59957540..ee2a0d555 100644
--- a/deploy/deploy-config.py
+++ b/deploy/deploy-config.py
@@ -143,22 +143,24 @@ def merge_dicts(dict1, dict2):
if k in dict1 and k in dict2:
if isinstance(dict1[k], dict) and isinstance(dict2[k], dict):
yield (k, dict(merge_dicts(dict1[k], dict2[k])))
- elif isinstance(dict1[k], list) and isinstance(dict2[k], list):
+ continue
+ if isinstance(dict1[k], list) and isinstance(dict2[k], list):
if k == 'versions':
yield (k,
merge_fuel_plugin_version_list(dict1[k], dict2[k]))
+ continue
if k == 'networks':
yield (k,
merge_networks(dict1[k], dict2[k]))
- else:
- # If one of the values is not a dict nor a list,
- # you can't continue merging it.
- # Value from second dict overrides one in first and we move on.
- yield (k, dict2[k])
- elif k in dict1:
- yield (k, dict1[k])
- else:
+ continue
+
+ # If one of the values is not a dict nor a list,
+ # you can't continue merging it.
+ # Value from second dict overrides one in first if exists.
+ if k in dict2:
yield (k, dict2[k])
+ else:
+ yield (k, dict1[k])
setup_yaml()