Stop logging unnecessary warning on context create
Every time a message is dispatched over rpc, it serializes the context using to_dict() method which includes "is_admin_project" key in the serialized context which when deserialized on the receiving end calls "from_dict" class method to build RequestContext object based on the dictionary. At the time of creation of this RequestContext object, a warning message is logged "Arguments dropped when creating context". Passed "is_admin_project" to __init__() of base RequestContext class so that the warning message will not come. Also this log message should be logged in debug level instead of warning as it's meant for developers and not operators. Developers can choose to see what arguments are getting dropped so that if required later it can be passed to base RequestContext. Kept the default value of "is_admin_project" as True [1]. [1] https://github.com/openstack/oslo.context/blob/master/oslo_context/context.py#L196 TrivialFix Change-Id: Ie301908fd037d08998d85c46f9da567a9448fdd2
This commit is contained in:
parent
603c52194a
commit
d4dd11d7bd
|
@ -28,7 +28,7 @@ from oslo_utils import timeutils
|
|||
import six
|
||||
|
||||
from masakari import exception
|
||||
from masakari.i18n import _, _LW
|
||||
from masakari.i18n import _
|
||||
from masakari import policy
|
||||
from masakari import utils
|
||||
|
||||
|
@ -102,13 +102,14 @@ class RequestContext(context.RequestContext):
|
|||
request_id=request_id,
|
||||
resource_uuid=kwargs.pop('resource_uuid', None),
|
||||
overwrite=overwrite,
|
||||
roles=roles)
|
||||
roles=roles,
|
||||
is_admin_project=kwargs.pop('is_admin_project', True))
|
||||
# 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:
|
||||
LOG.warning(_LW('Arguments dropped when creating context: %s'),
|
||||
str(kwargs))
|
||||
LOG.debug('Arguments dropped when creating context: %s',
|
||||
str(kwargs))
|
||||
|
||||
# FIXME: user_id and project_id duplicate information that is
|
||||
# already present in the oslo_context's RequestContext. We need to
|
||||
|
|
Loading…
Reference in New Issue