From b3a4b8852a209c69d2b9432339b138385852addc Mon Sep 17 00:00:00 2001 From: Richard Theis Date: Wed, 10 Feb 2016 13:37:42 -0600 Subject: [PATCH] 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 --- openstackclient/common/availability_zone.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openstackclient/common/availability_zone.py b/openstackclient/common/availability_zone.py index a941418be2..a6d11b7849 100644 --- a/openstackclient/common/availability_zone.py +++ b/openstackclient/common/availability_zone.py @@ -146,21 +146,20 @@ class ListAvailabilityZone(command.Lister): def _get_network_availability_zones(self, parsed_args): network_client = self.app.client_manager.network - data = [] try: # Verify that the extension exists. network_client.find_extension('Availability Zone', ignore_missing=False) - data = network_client.availability_zones() except Exception as e: self.log.debug('Network availability zone exception: ' + str(e)) if parsed_args.network: message = "Availability zones list not supported by " \ "Network API" self.log.warning(message) + return [] result = [] - for zone in data: + for zone in network_client.availability_zones(): result += _xform_network_availability_zone(zone) return result