Refactor network AZ exception handling
Exceptions that occur while getting network availability zones should not be masked as if the extension does not exist. Change-Id: I07213ec6c4d83e97261b58bf8d42417c1cdfae6a Related-Bug: #1534202
This commit is contained in:
parent
624c39ab1b
commit
b3a4b8852a
@ -146,21 +146,20 @@ class ListAvailabilityZone(command.Lister):
|
|||||||
|
|
||||||
def _get_network_availability_zones(self, parsed_args):
|
def _get_network_availability_zones(self, parsed_args):
|
||||||
network_client = self.app.client_manager.network
|
network_client = self.app.client_manager.network
|
||||||
data = []
|
|
||||||
try:
|
try:
|
||||||
# Verify that the extension exists.
|
# Verify that the extension exists.
|
||||||
network_client.find_extension('Availability Zone',
|
network_client.find_extension('Availability Zone',
|
||||||
ignore_missing=False)
|
ignore_missing=False)
|
||||||
data = network_client.availability_zones()
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log.debug('Network availability zone exception: ' + str(e))
|
self.log.debug('Network availability zone exception: ' + str(e))
|
||||||
if parsed_args.network:
|
if parsed_args.network:
|
||||||
message = "Availability zones list not supported by " \
|
message = "Availability zones list not supported by " \
|
||||||
"Network API"
|
"Network API"
|
||||||
self.log.warning(message)
|
self.log.warning(message)
|
||||||
|
return []
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
for zone in data:
|
for zone in network_client.availability_zones():
|
||||||
result += _xform_network_availability_zone(zone)
|
result += _xform_network_availability_zone(zone)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user