Skip to content

Commit

Permalink
Adds the tenant id to the create images response Location header
Browse files Browse the repository at this point in the history
Fixes bug 862672

Change-Id: I85fc91c64146b02718dad77686762e26bdfce08c
  • Loading branch information
ameade committed Sep 29, 2011
1 parent eb4bd86 commit f3fb16a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion nova/api/openstack/servers.py
Expand Up @@ -1244,7 +1244,10 @@ def _action_create_image(self, input_dict, req, instance_id):

# build location of newly-created image entity
image_id = str(image['id'])
image_ref = os.path.join(req.application_url, 'images', image_id)
image_ref = os.path.join(req.application_url,
context.project_id,
'images',
image_id)

resp = webob.Response(status_int=202)
resp.headers['Location'] = image_ref
Expand Down
4 changes: 2 additions & 2 deletions nova/tests/api/openstack/test_server_actions.py
Expand Up @@ -871,7 +871,7 @@ def test_create_image(self):
response = req.get_response(fakes.wsgi_app())
self.assertEqual(202, response.status_int)
location = response.headers['Location']
self.assertEqual('http://localhost/v1.1/images/123', location)
self.assertEqual('http://localhost/v1.1/fake/images/123', location)

def test_create_image_snapshots_disabled(self):
"""Don't permit a snapshot if the allow_instance_snapshots flag is
Expand Down Expand Up @@ -904,7 +904,7 @@ def test_create_image_with_metadata(self):
response = req.get_response(fakes.wsgi_app())
self.assertEqual(202, response.status_int)
location = response.headers['Location']
self.assertEqual('http://localhost/v1.1/images/123', location)
self.assertEqual('http://localhost/v1.1/fake/images/123', location)

def test_create_image_with_too_much_metadata(self):
body = {
Expand Down

0 comments on commit f3fb16a

Please sign in to comment.