1 From a7a2e8ff1c3389063b4d73805d0bbdbd7376f090 Mon Sep 17 00:00:00 2001
2 From: Josep Puigdemont <josep.puigdemont@enea.com>
3 Date: Wed, 13 Jul 2016 18:29:05 +0200
4 Subject: [PATCH] deploy-config: honor interfaces and transformations
6 Currently all scenarios assume interfaces and transformations are the
7 same for all nodes in the POD, however some PODs may contain nodes that
8 have different hardware, or where the interfaces are configured
11 In this patch we honor the original interfaces and transformations if
12 they are present in the dea-override.yaml file. The way to add this
13 information in the dea-override is by having a "nodes:" section with
18 interfaces: interfaces_1
19 transformations: transformations_1
21 interfaces: interfaces_2
22 transformations: transformations_2
24 interfaces: interfaces_1
25 transformations: transformations_1
27 The node IDs is used to find out this information.
29 Change-Id: If6ff8ca28b42e043d1bdf91142a4a56ae36e4304
30 Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com>
32 deploy/deploy-config.py | 23 +++++++++++++++++++++++
33 1 file changed, 23 insertions(+)
35 diff --git a/deploy/deploy-config.py b/deploy/deploy-config.py
36 index 88a1111..5dfb863 100644
37 --- a/deploy/deploy-config.py
38 +++ b/deploy/deploy-config.py
39 @@ -167,5 +167,6 @@ dea_base_sha = sha_uri(kwargs["dea_base_uri"])
40 dea_base_comment = dea_base_conf['dea-base-config-metadata']['comment']
41 dea_base_conf.pop('dea-base-config-metadata')
42 final_dea_conf = dea_base_conf
43 +dea_pod_override_nodes = None
45 # Fetch dea-pod-override, extract and purge meta-data, merge with previous dea data structure
46 @@ -180,4 +181,7 @@ if dea_pod_override_conf:
47 dea_pod_override_conf.pop('dea-pod-override-config-metadata')
48 + # Copy the list of original nodes, which holds info on their transformations
49 + if dea_pod_override_conf.has_key('nodes'):
50 + dea_pod_override_nodes = list(dea_pod_override_conf['nodes'])
51 if dea_pod_override_conf:
52 final_dea_conf = dict(merge_dicts(final_dea_conf, dea_pod_override_conf))
54 @@ -245,6 +249,25 @@ if deploy_scenario_conf["stack-extensions"]:
55 dea_scenario_module_override_conf['settings']['editable'][module["module"]] = scenario_module_override_conf
56 final_dea_conf = dict(merge_dicts(final_dea_conf, dea_scenario_module_override_conf))
58 +def get_node_ifaces_and_trans(nodes, nid):
60 + if node['id'] == nid:
61 + if node.has_key('transformations') and node.has_key('interfaces'):
62 + return (node['interfaces'], node['transformations'])
68 +if dea_pod_override_nodes:
69 + for node in final_dea_conf['nodes']:
70 + data = get_node_ifaces_and_trans(dea_pod_override_nodes, node['id'])
72 + print "Honoring original interfaces and transformations for " \
73 + "node %d to %s, %s" % (node['id'], data[0], data[1])
74 + node['interfaces'] = data[0]
75 + node['transformations'] = data[1]
77 # Dump final dea.yaml including configuration management meta-data to argument provided
79 if not os.path.exists(kwargs["output_path"]):