Remove duplicate RBAC logging from enforcer

A recent change to oslo.policy allowed RBAC enforcement data to be
logged there, making it more reusable and consistent for other
services using oslo.policy:

  I4642c57990b145c0e691140970574412682e66a5

This commit removes keystone-specific code for debug logging the same
information.

Change-Id: I75a342e84cddf6023470cd00fb34ca1c40dab956
This commit is contained in:
Lance Bragstad 2018-12-12 19:58:29 +00:00 committed by Colleen Murphy
parent 36b7e7e5bc
commit 969fa5df6f

View File

@ -375,9 +375,6 @@ class RBACEnforcer(object):
# Generate the filter_attr dataset.
policy_dict.update(cls._extract_filter_values(filters))
# Extract the cred data
ctxt = cls._get_oslo_req_context()
creds = ctxt.to_policy_values()
flattened = utils.flatten_dict(policy_dict)
if LOG.logger.getEffectiveLevel() <= log.DEBUG:
# LOG the Args
@ -388,21 +385,7 @@ class RBACEnforcer(object):
LOG.debug('RBAC: Authorizing `%(action)s(%(args)s)`',
{'action': action, 'args': args_str})
# LOG the Cred Data
cred_str = ', '.join(['%s=%s' % (k, v) for k, v in creds.items()])
cred_str = strutils.mask_password(cred_str)
LOG.debug('RBAC: Policy Enforcement Cred Data '
'`%(action)s creds(%(cred_str)s)`',
{'action': action, 'cred_str': cred_str})
# Log the Target Data
target_str = ', '.join(
['%s=%s' % (k, v) for k, v in flattened.items()])
target_str = strutils.mask_password(target_str)
LOG.debug('RBAC: Policy Enforcement Target Data '
'`%(action)s => target(%(target_str)s)`',
{'action': action, 'target_str': target_str})
ctxt = cls._get_oslo_req_context()
# Instantiate the enforcer object if needed.
enforcer_obj = enforcer or cls()
enforcer_obj._enforce(