Merge "Remove deprecated context usage"

This commit is contained in:
Zuul 2017-10-16 01:17:36 +00:00 committed by Gerrit Code Review
commit 5e6dd90b6b
2 changed files with 19 additions and 18 deletions

View File

@ -243,12 +243,13 @@ def inject_context(req, resp, params):
"""
client_id = req.get_header('Client-ID')
project_id = params.get('project_id')
request_id = req.headers.get('X-Openstack-Request-ID'),
request_id = req.headers.get('X-Openstack-Request-ID')
auth_token = req.headers.get('X-AUTH-TOKEN')
user = req.headers.get('X-USER-ID')
tenant = req.headers.get('X-TENANT-ID')
project_id = params.get('project_id')
user_id = req.headers.get('X-USER-ID')
domain_id = req.headers.get('X-DOMAIN-ID')
project_domain_id = req.headers.get('X-PROJECT-DOMAIN-ID')
user_domain_id = req.headers.get('X-USER-DOMAIN-ID')
roles = req.headers.get('X-ROLES')
roles = roles and roles.split(',') or []
@ -256,7 +257,9 @@ def inject_context(req, resp, params):
client_id=client_id,
request_id=request_id,
auth_token=auth_token,
user=user,
tenant=tenant,
roles=roles)
user_id=user_id,
roles=roles,
domain_id=domain_id,
project_domain_id=project_domain_id,
user_domain_id=user_domain_id)
req.env['zaqar.context'] = ctxt

View File

@ -23,22 +23,20 @@ from oslo_context import context
class RequestContext(context.RequestContext):
def __init__(self, project_id=None, client_id=None, overwrite=True,
auth_token=None, user=None, tenant=None, domain=None,
user_domain=None, project_domain=None, is_admin=False,
read_only=False, show_deleted=False, request_id=None,
instance_uuid=None, roles=None, **kwargs):
auth_token=None, user_id=None, domain_id=None,
user_domain_id=None, project_domain_id=None, is_admin=False,
read_only=False, request_id=None, roles=None, **kwargs):
super(RequestContext, self).__init__(auth_token=auth_token,
user=user,
tenant=tenant,
domain=domain,
user_domain=user_domain,
project_domain=project_domain,
user=user_id,
tenant=project_id,
domain=domain_id,
user_domain=user_domain_id,
project_domain=project_domain_id,
is_admin=is_admin,
read_only=read_only,
show_deleted=False,
request_id=request_id,
roles=roles)
self.project_id = project_id
self.client_id = client_id
if overwrite or not hasattr(context._request_store, 'context'):
self.update_store()