summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-02-08 20:56:25 +0000
committerGerrit Code Review <review@openstack.org>2012-02-08 20:56:25 +0000
commit799713e4db7f55ccc6acaa033fa082075e28a6a9 (patch)
treef04810370aba900481d3bd3dd7bd7b6be92ca9de /nova/api
parent1a0c3d5d2fbbafd545b8c70cedf82ef5973c5534 (diff)
parent7eca1aed7db7d3d60192f88aaecc43f8001106ec (diff)
downloadnova-799713e4db7f55ccc6acaa033fa082075e28a6a9.tar.gz
nova-799713e4db7f55ccc6acaa033fa082075e28a6a9.tar.xz
nova-799713e4db7f55ccc6acaa033fa082075e28a6a9.zip
Merge "Adding the request id to response headers. Again."
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/wsgi.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py
index af62f9b28..ecfdd1ac7 100644
--- a/nova/api/openstack/wsgi.py
+++ b/nova/api/openstack/wsgi.py
@@ -819,8 +819,8 @@ class Resource(wsgi.Application):
action_args.update(contents)
project_id = action_args.pop("project_id", None)
- if ('nova.context' in request.environ and project_id
- and project_id != request.environ['nova.context'].project_id):
+ context = request.environ.get('nova.context')
+ if (context and project_id and (project_id != context.project_id)):
msg = _("Malformed request url")
return Fault(webob.exc.HTTPBadRequest(explanation=msg))
@@ -848,6 +848,8 @@ class Resource(wsgi.Application):
# Run post-processing extensions
if resp_obj:
+ if context:
+ resp_obj['x-compute-request-id'] = context.request_id
# Do a preserialize to set up the response object
serializers = getattr(meth, 'wsgi_serializers', {})
resp_obj._bind_method_serializers(serializers)