Stop spamming logs when creating context

Pass through the rest of the arguments for the oslo_context's
RequestContext class if they are in our constructor's kwargs.
This will prevent us from logging them as arguments that we
drop explicitly.

Closes-Bug: #1431549
Change-Id: Ie804a6117accc0e35ef5cfd31360a79636630e21
This commit is contained in:
Davanum Srinivas 2015-03-13 12:28:47 -04:00
parent 68e521ad4b
commit a45f24e481

View File

@ -93,9 +93,18 @@ class RequestContext(context.RequestContext):
auth_token=auth_token, auth_token=auth_token,
user=user_id or user, user=user_id or user,
tenant=project_id or tenant, tenant=project_id or tenant,
domain=kwargs.pop('domain', None),
user_domain=kwargs.pop('user_domain', None),
project_domain=kwargs.pop('project_domain', None),
is_admin=is_admin, is_admin=is_admin,
read_only=kwargs.pop('read_only', False),
show_deleted=kwargs.pop('show_deleted', False),
request_id=request_id, request_id=request_id,
resource_uuid=kwargs.pop('resource_uuid', None),
overwrite=overwrite) overwrite=overwrite)
# oslo_context's RequestContext.to_dict() generates this field, we can
# safely ignore this as we don't use it.
kwargs.pop('user_identity', None)
if kwargs: if kwargs:
LOG.warning(_LW('Arguments dropped when creating context: %s') % LOG.warning(_LW('Arguments dropped when creating context: %s') %
str(kwargs)) str(kwargs))