Code review comment for lp:~jaypipes/nova/glance-image-service

Revision history for this message
Rick Harris (rconradharris) wrote :

Overall, looks excellent.

I think the Parallax get_image and get_image_metadata might need a slight modification. Currently, Parallax returns the JSON with the form dict(image=image_info) or dict(images=image_list). So, you probably want to

try:
    return json.loads(resp.read())['images']
except KeyError:
     raise ImageServiceException('Received malformed json from Parallax')

(The reason I return the json as dict(image=image_info) rather than just returning the image_info as a dict directly-- as would make sense-- is that, when we do support XML, we'll need a name for the root tag. By doing it this way, JSON and XML can be derived from the exact same dict-representation.)

A teensy correction:

186 + # TODO(jaypipes): return or raise HTTP error?
187 + return []

get_image_metadata should return None if image is not found/available.

review: Needs Fixing

« Back to merge proposal