commit c27af238ad99c0330eb4b55398f44be28e6f0485
Author: Matt Riedemann <email address hidden>
Date: Mon Dec 10 14:58:46 2018 -0500
Fix target used in nova.policy.check_is_admin
The target passed to Enforcer.authorize should be a dict,
similar to the target dict to the RequestContext.can method.
However, we were passing an instance of _DeprecatedPolicyValues
because that is ultimately what comes out of
RequestContext.to_policy_values(). As of change
I4642c57990b145c0e691140970574412682e66a5 in oslo.policy, that
incorrect type for the target parameter results in an error in
the debug logs for the policy check:
cannot format data, exception: Expected a dictionary, got
<class 'oslo_context.context._DeprecatedPolicyValues'> instead.
This resolves the issue by using the same default target dict
that RequestContext.can uses if a target is not supplied.
Note that we get here from NovaKeystoneContext via API middleware
before any request handler is invoked in the wsgi stack, so there
is no context from the request as to what to pass for the target
besides the user_id/project_id.
Reviewed: https:/ /review. opendev. org/624185 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=c27af238ad9 9c0330eb4b55398 f44be28e6f0485
Committed: https:/
Submitter: Zuul
Branch: master
commit c27af238ad99c03 30eb4b55398f44b e28e6f0485
Author: Matt Riedemann <email address hidden>
Date: Mon Dec 10 14:58:46 2018 -0500
Fix target used in nova.policy. check_is_ admin
The target passed to Enforcer.authorize should be a dict, cyValues ext.to_ policy_ values( ). As of change b145c0e69114097 0574412682e66a5 in oslo.policy, that
similar to the target dict to the RequestContext.can method.
However, we were passing an instance of _DeprecatedPoli
because that is ultimately what comes out of
RequestCont
I4642c57990
incorrect type for the target parameter results in an error in
the debug logs for the policy check:
cannot format data, exception: Expected a dictionary, got context. _DeprecatedPoli cyValues' > instead.
<class 'oslo_context.
This resolves the issue by using the same default target dict
that RequestContext.can uses if a target is not supplied.
Note that we get here from NovaKeystoneContext via API middleware
before any request handler is invoked in the wsgi stack, so there
is no context from the request as to what to pass for the target
besides the user_id/project_id.
Change-Id: I4442a7b95d1523 3f76f7795d45b18 ac440ddb831
Closes-Bug: #1807747