fix: response model for Service

- try/except around generator for domains, while checking for their
  status.

Change-Id: I26851664d382799e859fefe6cd46aea4ffd309e2
This commit is contained in:
Sriram Madapusi Vasudevan 2015-10-20 12:36:40 -04:00
parent d649564d9e
commit 352a5f0fe9
1 changed files with 16 additions and 12 deletions

View File

@ -92,18 +92,22 @@ class Model(collections.OrderedDict):
# add the access urls
access_urls = provider_detail.access_urls
for access_url in access_urls:
domain_info = next(d for d in self["domains"]
if d['domain'] == access_url['domain'])
# If the domain's status is not deployed,
# don't show the access url since the domain is not usable yet
if domain_info.get("protocol", "http") == "https":
if (provider_detail.
domains_certificate_status.
get_domain_certificate_status(
domain_d['domain']) in ['create_in_progress',
'failed']):
continue
try:
domain_info = next(d for d in self["domains"]
if d.get('domain') ==
access_url.get('domain'))
# If the domain's status is not deployed,
# don't show the access url since the domain
# is not usable yet
if domain_info.get("protocol", "http") == "https":
if (provider_detail.
domains_certificate_status.
get_domain_certificate_status(
domain_d['domain']) in ['create_in_progress',
'failed']):
continue
except StopIteration:
pass
if 'operator_url' in access_url:
self['links'].append(link.Model(
access_url['operator_url'],