+class GlanceImageByDockerNameApi(Resource):
+ def __init__(self, api):
+ self.api = api
+
+ def get(self, owner, container):
+ logging.debug("API CALL: %s GET" % str(self.__class__.__name__))
+ try:
+ name = "%s/%s" % (owner, container)
+ if name in self.api.compute.images:
+ image = self.api.compute.images[name]
+ resp = dict()
+ resp['id'] = image.id
+ resp['name'] = image.name
+ return Response(json.dumps(resp), status=200, mimetype="application/json")
+
+ response = Response("Image with id or name %s does not exists." % id, status=404)
+ response.headers['Access-Control-Allow-Origin'] = '*'
+ return response
+
+ except Exception as ex:
+ logging.exception(u"%s: Could not retrieve image with id %s." % (__name__, id))
+ return Response(ex.message, status=500, mimetype='application/json')