summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorMichael Gundlach <michael.gundlach@rackspace.com>2010-08-23 13:26:10 -0400
committerMichael Gundlach <michael.gundlach@rackspace.com>2010-08-23 13:26:10 -0400
commit35a08780c41ece1b47b2ded98c061b103a400fea (patch)
tree04730764b8a1bf8d9d26db503d5cbf0748cbc83a /nova/api
parentc49c725e43cfbc9d90b5e9ebbf93a32e71c7e6a9 (diff)
downloadnova-35a08780c41ece1b47b2ded98c061b103a400fea.tar.gz
nova-35a08780c41ece1b47b2ded98c061b103a400fea.tar.xz
nova-35a08780c41ece1b47b2ded98c061b103a400fea.zip
Get the output formatting correct.
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/rackspace/images.py9
-rw-r--r--nova/api/services/image.py3
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