Skip to content

Commit

Permalink
Build oslo.context RequestContext
Browse files Browse the repository at this point in the history
During the request, an oslo.context RequestContext is created.
This allows the log to contain the request ID as set by the
request_id middleware.

Change-Id: Ib27d91c20a58a48d611a7c0b42134f4970ff42a8
Closes-Bug: 1485604
  • Loading branch information
Brant Knudson committed Sep 3, 2015
1 parent 95f6405 commit 8719f5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions keystone/middleware/core.py
Expand Up @@ -13,6 +13,7 @@
# under the License.

from oslo_config import cfg
from oslo_context import context as oslo_context
from oslo_log import log
from oslo_log import versionutils
from oslo_middleware import sizelimit
Expand Down Expand Up @@ -280,6 +281,11 @@ def _validate_trusted_issuer(self, env):
return False

def process_request(self, request):

# The request context stores itself in thread-local memory for logging.
oslo_context.RequestContext(
request_id=request.environ.get('openstack.request_id'))

if authorization.AUTH_CONTEXT_ENV in request.environ:
msg = _LW('Auth context already exists in the request '
'environment; it will be used for authorization '
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Expand Up @@ -20,6 +20,7 @@ python-keystoneclient>=1.6.0
keystonemiddleware>=2.0.0
oslo.concurrency>=2.3.0 # Apache-2.0
oslo.config>=2.3.0 # Apache-2.0
oslo.context>=0.2.0 # Apache-2.0
oslo.messaging!=1.17.0,!=1.17.1,>=1.16.0 # Apache-2.0
oslo.db>=2.4.1 # Apache-2.0
oslo.i18n>=1.5.0 # Apache-2.0
Expand Down

0 comments on commit 8719f5a

Please sign in to comment.