Add middleware generated request_id to context
The RequestId middleware will generate request_id for each request. This commit adds the request_id to context. If this is not done, the context will generate another request_id which leads to inconsistency because there are two request_ids. Change-Id: Ibca201a19a4ac2c7b6db5ead8459a4a49b571ca2
This commit is contained in:
parent
9f98a16566
commit
1b7763194d
|
@ -13,6 +13,7 @@
|
|||
# under the License.
|
||||
|
||||
|
||||
from oslo_middleware import request_id
|
||||
from pecan import hooks
|
||||
|
||||
from zun.common import context
|
||||
|
@ -57,10 +58,12 @@ class ContextHook(hooks.PecanHook):
|
|||
auth_token = headers.get('X-Auth-Token')
|
||||
roles = headers.get('X-Roles', '').split(',')
|
||||
auth_token_info = state.request.environ.get('keystone.token_info')
|
||||
req_id = state.request.environ.get(request_id.ENV_REQUEST_ID)
|
||||
|
||||
state.request.context = context.make_context(
|
||||
auth_token=auth_token,
|
||||
auth_token_info=auth_token_info,
|
||||
request_id=req_id,
|
||||
user_name=user_name,
|
||||
user_id=user_id,
|
||||
project_name=project,
|
||||
|
|
Loading…
Reference in New Issue