From 053ec934ceb42d1c829a0af9aebe91096c6dbae6 Mon Sep 17 00:00:00 2001 From: Adrian Turjak Date: Mon, 12 Feb 2018 15:18:41 +1300 Subject: [PATCH] Don't catch exceptions in quota manager For these exceptions it is probably safer to actually raise them and throw a 500. That way a notification goes out, and we deal with it and potentially rerun the actions. The responsibility is on the deployer to correctly configure the QUOTA_SERVICES setting, and eventually we will also add checking against the catalog for service types in a given region. Change-Id: I3fa6013cb3dd02ae40109a10c79211e55cb73ef8 --- adjutant/common/quota.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/adjutant/common/quota.py b/adjutant/common/quota.py index 4a5de96..7f49c7b 100644 --- a/adjutant/common/quota.py +++ b/adjutant/common/quota.py @@ -232,11 +232,8 @@ class QuotaManager(object): region_helpers = self.helpers.get(region_id, self.default_helpers) for name, service in region_helpers.items(): - try: - helper = service(region_id, self.project_id) - current_usage[name] = helper.get_usage() - except Exception: - pass + helper = service(region_id, self.project_id) + current_usage[name] = helper.get_usage() return current_usage def set_region_quota(self, region_id, quota_dict): @@ -249,15 +246,7 @@ class QuotaManager(object): service_name) continue - try: - service_helper = updater_class(region_id, self.project_id) - except Exception: - # NOTE(amelia): We will assume if there are issues connecting - # to a service that it will be due to the - # service not existing in this region. - notes.append("Couldn't access %s client, region %s" % - (service_name, region_id)) - continue + service_helper = updater_class(region_id, self.project_id) service_helper.set_quota(values) return notes