Merge "Add middleware generated request_id to context"

This commit is contained in:
Zuul 2019-04-16 04:16:36 +00:00 committed by Gerrit Code Review
commit 5178395780
1 changed files with 3 additions and 0 deletions

View File

@ -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,