[placement] Use modern attributes of oslo_context
user and tenant have been deprecated since version 2.6, replaced by user_id and project_id respectively. requirements.txt requires at least 2.9.0. These changes are covered by existing tests. See Ia62158e0eed50a34114718ee724b038f577c7e87 for the original addition. Change-Id: I3f6b2da692810afe5a684bb5e878ea750b17db5a Closes-Bug: #1660667
This commit is contained in:
parent
dae6b760b9
commit
5fb197914a
|
@ -71,7 +71,7 @@ class PlacementKeystoneContext(Middleware):
|
|||
ctx = RequestContext.from_environ(
|
||||
req.environ, request_id=req_id)
|
||||
|
||||
if ctx.user is None:
|
||||
if ctx.user_id is None:
|
||||
LOG.debug("Neither X_USER_ID nor X_USER found in request")
|
||||
return webob.exc.HTTPUnauthorized()
|
||||
|
||||
|
|
|
@ -60,8 +60,8 @@ def placement_authorize(context, action, target=None):
|
|||
"""
|
||||
placement_init()
|
||||
if target is None:
|
||||
target = {'project_id': context.tenant,
|
||||
'user_id': context.user}
|
||||
target = {'project_id': context.project_id,
|
||||
'user_id': context.user_id}
|
||||
credentials = context.to_policy_values()
|
||||
# TODO(alaski): Change this to use authorize() when rules are registered.
|
||||
# noqa the following line because a hacking check disallows using enforce.
|
||||
|
|
Loading…
Reference in New Issue