Merge lp:~rackspace-titan/nova/images-links-lp803505 into lp:~hudson-openstack/nova/trunk

Proposed by Brian Waldon
Status: Merged
Approved by: Brian Lamar
Approved revision: 1272
Merged at revision: 1280
Proposed branch: lp:~rackspace-titan/nova/images-links-lp803505
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 55 lines (+21/-11)
2 files modified
nova/api/openstack/views/images.py (+11/-7)
nova/tests/api/openstack/test_images.py (+10/-4)
To merge this branch: bzr merge lp:~rackspace-titan/nova/images-links-lp803505
Reviewer Review Type Date Requested Status
Brian Lamar (community) Approve
William Wolf (community) Approve
Devin Carlen (community) Approve
Review via email: mp+67986@code.launchpad.net

Description of the change

Ensures a bookmark link is returned in GET /images. Before, it was only returned in GET /images/detail

To post a comment you must log in.
Revision history for this message
Devin Carlen (devcamcar) wrote :

lgtm

review: Approve
Revision history for this message
William Wolf (throughnothing) wrote :

Looks good Brian.

review: Approve
Revision history for this message
Brian Lamar (blamar) wrote :

Works for me!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/api/openstack/views/images.py'
2--- nova/api/openstack/views/images.py 2011-07-12 16:46:15 +0000
3+++ nova/api/openstack/views/images.py 2011-07-14 16:06:08 +0000
4@@ -121,16 +121,20 @@
5 href = self.generate_href(image_obj["id"])
6 bookmark = self.generate_bookmark(image_obj["id"])
7
8- image["links"] = [{
9- "rel": "self",
10- "href": href,
11- }]
12+ image["links"] = [
13+ {
14+ "rel": "self",
15+ "href": href,
16+ },
17+ {
18+ "rel": "bookmark",
19+ "href": bookmark,
20+ },
21+
22+ ]
23
24 if detail:
25 image["metadata"] = image_obj.get("properties", {})
26- image["links"].append({"rel": "bookmark",
27- "href": bookmark,
28- })
29
30 return image
31
32
33=== modified file 'nova/tests/api/openstack/test_images.py'
34--- nova/tests/api/openstack/test_images.py 2011-07-12 18:19:30 +0000
35+++ nova/tests/api/openstack/test_images.py 2011-07-14 16:06:08 +0000
36@@ -568,10 +568,16 @@
37 test_image = {
38 "id": image["id"],
39 "name": image["name"],
40- "links": [{
41- "rel": "self",
42- "href": href,
43- }],
44+ "links": [
45+ {
46+ "rel": "self",
47+ "href": href,
48+ },
49+ {
50+ "rel": "bookmark",
51+ "href": bookmark,
52+ },
53+ ],
54 }
55 self.assertTrue(test_image in response_list)
56