Fix the traceback when checking on stale ports (Kilo)

Change-Id: I2451ef79cc32cff5023bfbc8eaf56fddbff46ccb
This commit is contained in:
Yichen Wang 2015-09-10 14:13:23 -07:00
parent 0ccb558524
commit 6bd6115b5f

View File

@ -203,11 +203,13 @@ class Network(object):
# Assumed that both management networks are created together so checking for one of them
ports = self.neutron_client.list_ports()['ports']
for port in ports:
port_ip = port['fixed_ips'][0]
if (port['device_id'] == self.ext_router['id']) and \
(port_ip['subnet_id'] == self.vm_int_net[0]['subnets'][0]):
print 'Ext router already associated to the internal network'
return
# Skip the check on stale ports
if port['fixed_ips']:
port_ip = port['fixed_ips'][0]
if (port['device_id'] == self.ext_router['id']) and \
(port_ip['subnet_id'] == self.vm_int_net[0]['subnets'][0]):
print 'Ext router already associated to the internal network'
return
for int_net in self.vm_int_net:
body = {