]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove "Arguments dropped when creating context" logging
authorAssaf Muller <amuller@redhat.com>
Wed, 1 Apr 2015 13:38:21 +0000 (09:38 -0400)
committerAssaf Muller <amuller@redhat.com>
Wed, 1 Apr 2015 13:38:21 +0000 (09:38 -0400)
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

neutron/context.py
neutron/tests/unit/test_neutron_context.py

index 1889b092dbe0077cc146980cd4d29d2d435f2c11..4e8bdfb255093540ce2c12bdcfdca18a8986119b 100644 (file)
@@ -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):
index 3af92997dc6c0589b4a031ff08b7974a1b4cedf5..a53cd111cf7ed132a10c8400d846702e18a6da90 100644 (file)
@@ -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')