From: Assaf Muller Date: Wed, 1 Apr 2015 13:38:21 +0000 (-0400) Subject: Remove "Arguments dropped when creating context" logging X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=a8c7db5b9d9bba44660de3c7a64295f9f318b63a;p=openstack-build%2Fneutron-build.git 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 --- diff --git a/neutron/context.py b/neutron/context.py index 1889b092d..4e8bdfb25 100644 --- a/neutron/context.py +++ b/neutron/context.py @@ -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): diff --git a/neutron/tests/unit/test_neutron_context.py b/neutron/tests/unit/test_neutron_context.py index 3af92997d..a53cd111c 100644 --- a/neutron/tests/unit/test_neutron_context.py +++ b/neutron/tests/unit/test_neutron_context.py @@ -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')