fix the logic of api.lbaas._pool_list

When the subnet is deleted first, _pool_list will access cidr from
a None object. As a result, a unexpected exception is thrown.

Change-Id: Iceb9dea1b0e8bab9ca54dfcdd2bf664c8677e0f2
Related-Bug: #1367615
This commit is contained in:
Li Ma 2014-09-10 03:02:03 -07:00
parent cdd64c2f61
commit 4d58e2c389

View File

@ -164,7 +164,8 @@ def _pool_list(request, expand_subnet=False, expand_vip=False, **kwargs):
subnets = neutron.subnet_list(request)
subnet_dict = SortedDict((s.id, s) for s in subnets)
for p in pools:
p['subnet_name'] = subnet_dict.get(p['subnet_id']).cidr
subnet = subnet_dict.get(p['subnet_id'])
p['subnet_name'] = subnet.cidr if subnet else None
if expand_vip:
vips = vip_list(request)
vip_dict = SortedDict((v.id, v) for v in vips)