Skip to content

Commit

Permalink
Return nice error in case of AppDB site:service
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Jul 23, 2024
1 parent 24dfa9f commit 1f10a99
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion IM/AppDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ def get_site_id(site_name, stype="occi"):
data = AppDB.appdb_call('/rest/1.0/sites')
if data:
for site in data['appdb:site']:
if site_name.lower() == site['@name'].lower() and site['@infrastructure'] == "Production":
if (site_name.lower() == site['@name'].lower() and
site['@infrastructure'] == "Production" and
'site:service' in site):
if isinstance(site['site:service'], list):
services = site['site:service']
else:
Expand All @@ -68,6 +70,8 @@ def get_site_url(site_id, stype="occi"):
"""
Get the site url from the site ID
"""
if not site_id:
return None
data = AppDB.appdb_call('/rest/1.0/va_providers/%s' % site_id)
site_url = None
if data:
Expand Down

0 comments on commit 1f10a99

Please sign in to comment.