Fix key error with unknown service in size

When Adjutant has sizes defined for a service that
only exists in certain regions, this can cause errors.

If we come across a region without that service, skip
the service.

Change-Id: Icc6b8cc3aaed408c10dc4fb54c54fe2376cf2a88
This commit is contained in:
Adrian Turjak 2018-05-02 12:59:27 +12:00
parent 479618c775
commit 4396ad3c87
1 changed files with 2 additions and 0 deletions

View File

@ -621,6 +621,8 @@ def size_details_get(request, size, region=None):
data = resp['quota_sizes'][size]
region_data = resp['regions'][0]['current_quota']
for service, values in six.iteritems(data):
if service not in resp['regions'][0]['current_usage']:
continue
for resource, value in six.iteritems(values):
if _is_quota_hidden(service, resource):
continue