summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Waldon <brian.waldon@rackspace.com>2011-07-14 12:03:06 -0400
committerBrian Waldon <brian.waldon@rackspace.com>2011-07-14 12:03:06 -0400
commit1539866314393e8565eef05f1f63dba9ffa69de3 (patch)
treecaf278a9ffc602a11522d43e42b6f1226ce3ba8d
parentfa2cdbc5d4201ace6c1a6459bbd653b0b63b7667 (diff)
downloadnova-1539866314393e8565eef05f1f63dba9ffa69de3.tar.gz
nova-1539866314393e8565eef05f1f63dba9ffa69de3.tar.xz
nova-1539866314393e8565eef05f1f63dba9ffa69de3.zip
adding bookmark to images index
-rw-r--r--nova/api/openstack/views/images.py18
-rw-r--r--nova/tests/api/openstack/test_images.py14
2 files changed, 21 insertions, 11 deletions
diff --git a/nova/api/openstack/views/images.py b/nova/api/openstack/views/images.py
index 5c0510377..873ce212a 100644
--- a/nova/api/openstack/views/images.py
+++ b/nova/api/openstack/views/images.py
@@ -121,16 +121,20 @@ class ViewBuilderV11(ViewBuilder):
href = self.generate_href(image_obj["id"])
bookmark = self.generate_bookmark(image_obj["id"])
- image["links"] = [{
- "rel": "self",
- "href": href,
- }]
+ image["links"] = [
+ {
+ "rel": "self",
+ "href": href,
+ },
+ {
+ "rel": "bookmark",
+ "href": bookmark,
+ },
+
+ ]
if detail:
image["metadata"] = image_obj.get("properties", {})
- image["links"].append({"rel": "bookmark",
- "href": bookmark,
- })
return image
diff --git a/nova/tests/api/openstack/test_images.py b/nova/tests/api/openstack/test_images.py
index c1bdd6906..534460d46 100644
--- a/nova/tests/api/openstack/test_images.py
+++ b/nova/tests/api/openstack/test_images.py
@@ -568,10 +568,16 @@ class ImageControllerWithGlanceServiceTest(test.TestCase):
test_image = {
"id": image["id"],
"name": image["name"],
- "links": [{
- "rel": "self",
- "href": href,
- }],
+ "links": [
+ {
+ "rel": "self",
+ "href": href,
+ },
+ {
+ "rel": "bookmark",
+ "href": bookmark,
+ },
+ ],
}
self.assertTrue(test_image in response_list)