summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhongjun <zhong.jun@zte.com.cn>2017-05-08 10:26:00 +0800
committerzhongjun <zhong.jun@zte.com.cn>2017-05-08 10:26:00 +0800
commit027ecc6d1dbfd5a4dece51bded00fc0aa75d4b8b (patch)
tree13e72e4645e806600a18d85d73cd4a0b4bde1bbe
parent568edb9d5ed462672d5a5c53ac735e04d8f687c4 (diff)
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 <zhong.jun@zte.com.cn>
-rw-r--r--deploy/post/execute.py5
1 files changed, 3 insertions, 2 deletions
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():