i hate these exceptions where it should just return an empty list

This commit is contained in:
Jason Koelker
2011-08-15 15:29:55 -05:00
parent 54ba0d6d25
commit d3e2be67d1

View File

@@ -656,7 +656,10 @@ class NetworkManager(manager.SchedulerDependentManager):
subnets_v4 = list(fixed_net_v4.subnet(prefixlen_v4,
count=num_networks))
nets = self.db.network_get_all(context)
try:
nets = self.db.network_get_all(context)
except exception.NoNetworksFound:
nets = []
used_subnets = [netaddr.IPNetwork(net['cidr']) for net in nets]
for subnet in subnets_v4: