diff --git a/IM/AppDB.py b/IM/AppDB.py index d496efb1..32d9b038 100644 --- a/IM/AppDB.py +++ b/IM/AppDB.py @@ -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: @@ -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: