summaryrefslogtreecommitdiffstats
path: root/deploy/deploy-config.py
diff options
context:
space:
mode:
authorFedor Zhadaev <fzhadaev@mirantis.com>2016-07-12 12:59:07 +0300
committerFedor Zhadaev <fzhadaev@mirantis.com>2016-08-04 15:00:02 +0300
commit04ae376792244b9d10419b798aa4f9f76481b247 (patch)
tree2e38e7ead4abe5e14b4d811f00ff7878731e474f /deploy/deploy-config.py
parentf0463e6234cd27eaa2e0cd3ded0b035d89aa918c (diff)
Fix OVS scenarios to use fuel-plugin-ovs
* Use fuel-nshovs instead deprecated fuel-nfvovs * Modified scenario to enable DPDK via Fuel * Removed hard dependency from specific POD * Add ability to merge networks lists JIRA: FUEL-156 JIRA: FUEL-162 Change-Id: Ie609ff140f1de96e54df37dd9b1881afec792317 Depends-On: Ic6072d938e09a40516c32cdde6223d0a21e57403 Signed-off-by: Fedor Zhadaev <fzhadaev@mirantis.com>
Diffstat (limited to 'deploy/deploy-config.py')
-rw-r--r--deploy/deploy-config.py29
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.