Remove "Arguments dropped when creating context" logging
This log was previously reduced from warning to debug. Cinder removed it entirely in: https://bugs.launchpad.net/cinder/+bug/1329156 The root cause is this: Agent heartbeats use an admin context. The context is serialized with its to_dict method, which exposes 'tenant' and 'project_name' (These are properties of the class that are calculated from other attributes). In the controller, this dict is used to initialize a ContextBase, which does not accept tenant and project_name as arguments, de facto sending those values as key word arguments. We can either handle 'tenant' and 'project_name' specially, fix it any other way, or drop the logging entirely. Is this logging ever useful? Change-Id: Ifd51b62bae7b96de44f04836015d2ed939bcb650 Closes-Bug: #1255441
This commit is contained in:
parent
0549c31b03
commit
a8c7db5b9d
|
@ -73,10 +73,6 @@ class ContextBase(oslo_context.RequestContext):
|
|||
admin_roles = policy.get_admin_roles()
|
||||
if admin_roles:
|
||||
self.roles = list(set(self.roles) | set(admin_roles))
|
||||
# Log only once the context has been configured to prevent
|
||||
# format errors.
|
||||
if kwargs:
|
||||
LOG.debug('Arguments dropped when creating context: %s', kwargs)
|
||||
|
||||
@property
|
||||
def project_id(self):
|
||||
|
|
|
@ -41,11 +41,6 @@ class TestNeutronContext(base.BaseTestCase):
|
|||
self.assertIsNone(ctx.tenant_name)
|
||||
self.assertIsNone(ctx.auth_token)
|
||||
|
||||
def test_neutron_context_create_logs_unknown_kwarg(self):
|
||||
with mock.patch.object(context.LOG, 'debug') as mock_log:
|
||||
context.Context('user_id', 'tenant_id', foo=None)
|
||||
self.assertEqual(mock_log.call_count, 1)
|
||||
|
||||
def test_neutron_context_create_with_name(self):
|
||||
ctx = context.Context('user_id', 'tenant_id',
|
||||
tenant_name='tenant_name', user_name='user_name')
|
||||
|
|
Loading…
Reference in New Issue