diff options
author | Michal Skalski <mskalski@mirantis.com> | 2016-08-08 10:08:55 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-08-08 10:08:55 +0000 |
commit | c15c41b96c1922fcb2b9bbb2661b3ae562fda375 (patch) | |
tree | a77ccf47c39010956f241d30e2457a5ee6e9bfff /deploy/deploy-config.py | |
parent | aa5d41bfa5ecdf5c53512194a9816cbec95b4da2 (diff) | |
parent | 04ae376792244b9d10419b798aa4f9f76481b247 (diff) |
Merge "Fix OVS scenarios to use fuel-plugin-ovs"
Diffstat (limited to 'deploy/deploy-config.py')
-rw-r--r-- | deploy/deploy-config.py | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/deploy/deploy-config.py b/deploy/deploy-config.py index d87103b6c..c59957540 100644 --- a/deploy/deploy-config.py +++ b/deploy/deploy-config.py @@ -131,23 +131,11 @@ def merge_fuel_plugin_version_list(list1, list2): return final_list -def merge_lists(list1, list2): - if list1 and list2: - if isinstance(list1[0], dict): - if 'plugin_version' in list1[0].get('metadata', {}): - return merge_fuel_plugin_version_list(list1, list2) - else: - warning("Lists with dictionary inside are not mergeable! " - "List2 will overwrite List1. " - "List1: %s\nList2: %s" - % (list1, list2)) - return list2 - else: - return list2 - elif list1: - return list1 - else: - return list2 +def merge_networks(list_1, list_2): + new_nets = {x.get('name'): x for x in list_2} + + return [new_nets.get(net.get('name'), net) for net in list_1] + def merge_dicts(dict1, dict2): @@ -156,7 +144,12 @@ def merge_dicts(dict1, 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): - yield (k, merge_lists(dict1[k], dict2[k])) + if k == 'versions': + yield (k, + merge_fuel_plugin_version_list(dict1[k], dict2[k])) + 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. |