diff options
| author | Michael Gundlach <michael.gundlach@rackspace.com> | 2010-08-23 13:26:10 -0400 |
|---|---|---|
| committer | Michael Gundlach <michael.gundlach@rackspace.com> | 2010-08-23 13:26:10 -0400 |
| commit | 35a08780c41ece1b47b2ded98c061b103a400fea (patch) | |
| tree | 04730764b8a1bf8d9d26db503d5cbf0748cbc83a | |
| parent | c49c725e43cfbc9d90b5e9ebbf93a32e71c7e6a9 (diff) | |
| download | nova-35a08780c41ece1b47b2ded98c061b103a400fea.tar.gz nova-35a08780c41ece1b47b2ded98c061b103a400fea.tar.xz nova-35a08780c41ece1b47b2ded98c061b103a400fea.zip | |
Get the output formatting correct.
| -rw-r--r-- | nova/api/rackspace/images.py | 9 | ||||
| -rw-r--r-- | nova/api/services/image.py | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/nova/api/rackspace/images.py b/nova/api/rackspace/images.py index 070100143..7d32fa099 100644 --- a/nova/api/rackspace/images.py +++ b/nova/api/rackspace/images.py @@ -53,14 +53,17 @@ class Controller(base.Controller): def index(self, req): """Return all public images.""" - data = dict((self._to_rs_id(id), val) - for id, val in self._svc.index().iteritems()) + data = self._svc.index() + for img in data: + img['id'] = self._to_rs_id(img['id']) return dict(images=data) def show(self, req, id): """Return data about the given image id.""" opaque_id = self._from_rs_id(id) - return dict(image=self._svc.show(opaque_id)) + img = self._svc.show(opaque_id) + img['id'] = id + return dict(image=img) def delete(self, req, id): # Only public images are supported for now. diff --git a/nova/api/services/image.py b/nova/api/services/image.py index 11e19804a..1a7a258b7 100644 --- a/nova/api/services/image.py +++ b/nova/api/services/image.py @@ -65,7 +65,7 @@ class LocalImageService(ImageService): return os.listdir(self._path) def index(self): - return dict((id, self.show(id)) for id in self._ids()) + return [ self.show(id) for id in self._ids() ] def show(self, id): return pickle.load(open(self._path_to(id))) @@ -75,6 +75,7 @@ class LocalImageService(ImageService): Store the image data and return the new image id. """ id = ''.join(random.choice(string.letters) for _ in range(20)) + data['id'] = id self.update(id, data) return id |
