From 52600e6bee170ac6d78eff004ecc98394c43ff6f Mon Sep 17 00:00:00 2001 From: "jaypipes@gmail.com" <> Date: Wed, 13 Oct 2010 16:17:23 -0400 Subject: Adds unit test for WSGI image controller for OpenStack API using Glance Service. --- nova/api/openstack/images.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/images.py b/nova/api/openstack/images.py index aa438739c..5f2d71dc2 100644 --- a/nova/api/openstack/images.py +++ b/nova/api/openstack/images.py @@ -48,8 +48,13 @@ class Controller(wsgi.Controller): def detail(self, req): """Return all public images in detail.""" - data = self._service.index() - data = nova.api.openstack.limited(data, req) + try: + data = self._service.detail() + except NotImplementedError: + # Emulate detail() using repeated calls to show() + images = self._service.index() + images = nova.api.openstack.limited(images, req) + data = [self._service.show(i['id']) for i in images] return dict(images=data) def show(self, req, id): -- cgit From 112992d5372a64b07de5188af6c2c0753981a3d6 Mon Sep 17 00:00:00 2001 From: "jaypipes@gmail.com" <> Date: Tue, 19 Oct 2010 16:09:12 -0400 Subject: Remember to call limited() on detail() in image controller. --- nova/api/openstack/images.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/images.py b/nova/api/openstack/images.py index 5f2d71dc2..5ccf659f7 100644 --- a/nova/api/openstack/images.py +++ b/nova/api/openstack/images.py @@ -49,13 +49,14 @@ class Controller(wsgi.Controller): def detail(self, req): """Return all public images in detail.""" try: - data = self._service.detail() + images = self._service.detail() + images = nova.api.openstack.limited(images, req) except NotImplementedError: # Emulate detail() using repeated calls to show() images = self._service.index() images = nova.api.openstack.limited(images, req) - data = [self._service.show(i['id']) for i in images] - return dict(images=data) + images = [self._service.show(i['id']) for i in images] + return dict(images=images) def show(self, req, id): """Return data about the given image id.""" -- cgit