From 027ecc6d1dbfd5a4dece51bded00fc0aa75d4b8b Mon Sep 17 00:00:00 2001 From: zhongjun Date: Mon, 8 May 2017 10:26:00 +0800 Subject: Compatible with the no mapping in network.yml 1)resolve the error ' AttributeError: 'NetworkConfig' object has no attribute 'ext_mapping'' with the no mapping in network.yml. 2)resolve the creating external subnet failure if the external netwok exists. Change-Id: I578365d91b8b61f9f88a5d4ff2c9db9ecc512edc Signed-off-by: zhongjun --- deploy/post/execute.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'deploy/post') diff --git a/deploy/post/execute.py b/deploy/post/execute.py index 37a67b4c..24061e0b 100644 --- a/deploy/post/execute.py +++ b/deploy/post/execute.py @@ -50,11 +50,12 @@ def _config_external_subnet(ext_id, network_conf): def _create_external_network(network_file): network_conf = NetworkConfig(network_file=network_file) ext_name = network_conf.ext_network_name - physnet = network_conf.ext_mapping + physnet = network_conf.ext_mapping if hasattr(network_conf, 'ext_mapping') else 'physnet1' neutronclient = neutron.Neutron() ext_id = neutronclient.create_network(ext_name, _config_external_network(ext_name, physnet)) - neutronclient.create_subnet(_config_external_subnet(ext_id, network_conf)) + if ext_id: + neutronclient.create_subnet(_config_external_subnet(ext_id, network_conf)) def _create_flavor_m1_micro(): -- cgit 1.2.3-korg