From c24ea3f84876ca4087710fc15a94c1a82ec1d5f0 Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Mon, 30 Jul 2012 20:50:27 -0700 Subject: [PATCH] Stop looking for v2 image in container The v2 API no longer returns images in JSON containers like '{"image": {...}}', so stop trying to decode the responses as if it does. Fix bug 1031185 Change-Id: I5209fe76445d4195b12944146a0ef190883f363f --- glanceclient/v2/images.py | 4 ++-- tests/v2/test_images.py | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/glanceclient/v2/images.py b/glanceclient/v2/images.py index 764f9c6a..09532f12 100644 --- a/glanceclient/v2/images.py +++ b/glanceclient/v2/images.py @@ -52,5 +52,5 @@ class Controller(object): resp, body = self.http_client.json_request('GET', url) #NOTE(bcwaldon): remove 'self' for now until we have an elegant # way to pass it into the model constructor without conflict - body['image'].pop('self', None) - return self.model(**body['image']) + body.pop('self', None) + return self.model(**body) diff --git a/tests/v2/test_images.py b/tests/v2/test_images.py index 9bdb7020..71821799 100644 --- a/tests/v2/test_images.py +++ b/tests/v2/test_images.py @@ -67,10 +67,8 @@ fixtures = { 'GET': ( {}, { - 'image': { - 'id': '3a4560a1-e585-443e-9b39-553b46ec92d1', - 'name': 'image-1', - }, + 'id': '3a4560a1-e585-443e-9b39-553b46ec92d1', + 'name': 'image-1', }, ), },