Skip to content

Commit

Permalink
Add log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Sep 19, 2017
1 parent 6cebd46 commit 34edeb9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions IM/connectors/OCCI.py
Original file line number Diff line number Diff line change
Expand Up @@ -1201,17 +1201,19 @@ def appdb_call(path):
else:
return None

@staticmethod
def get_site_id(site_name):
def get_site_id(self, site_name):
data = OCCICloudConnector.appdb_call('/rest/1.0/va_providers')
if data:
for site in data['appdb:appdb']['virtualization:provider']:
if site_name == site['provider:name'] and site['@in_production'] == "true":
return site['@id']
else:
self.log_warn("No data returned from EGI AppDB.")

self.log_warn("No site ID returned from EGI AppDB for site: %s." % site_name)
return None

@staticmethod
def get_image_id_and_site_url(site_id, image_name, vo_name=None):
def get_image_id_and_site_url(self, site_id, image_name, vo_name=None):
data = OCCICloudConnector.appdb_call('/rest/1.0/va_providers/%s' % site_id)
if data:
site_url = data['appdb:appdb']['virtualization:provider']["provider:endpoint_url"]
Expand All @@ -1224,6 +1226,10 @@ def get_image_id_and_site_url(site_id, image_name, vo_name=None):
return parts[1], site_url
else:
return image_basename, site_url
else:
self.log_warn("No data returned from EGI AppDB.")

self.log_warn("No image ID returned from EGI AppDB for image: %s/%s." % (site_id, image_name))
return '', ''


Expand Down

0 comments on commit 34edeb9

Please sign in to comment.