]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
remove token from notifier middleware
authorGordon Chung <chungg@ca.ibm.com>
Thu, 22 May 2014 14:51:25 +0000 (10:51 -0400)
committerGordon Chung <chungg@ca.ibm.com>
Thu, 22 May 2014 14:53:01 +0000 (10:53 -0400)
notifier middleware is capturing token and sending it to MQ. this
is not advisable so we should filter it out.

Closes-Bug: #1321080
Change-Id: Ia1bfa1bd24989681db1d2f385defc12e69a01f8d

neutron/openstack/common/middleware/notifier.py

index 1dce3f53d49ad8e6f977db7f615c5f7824b65148..e34699c5a51f75dc8fad5733e3158b56f818013b 100644 (file)
@@ -24,7 +24,7 @@ import six
 import webob.dec
 
 from neutron.openstack.common import context
-from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common.gettextutils import _LE
 from neutron.openstack.common import log as logging
 from neutron.openstack.common.middleware import base
 from neutron.openstack.common.notifier import api
@@ -37,8 +37,8 @@ def log_and_ignore_error(fn):
         try:
             return fn(*args, **kwargs)
         except Exception as e:
-            LOG.exception(_('An exception occurred processing '
-                            'the API call: %s ') % e)
+            LOG.exception(_LE('An exception occurred processing '
+                              'the API call: %s ') % e)
     return wrapped
 
 
@@ -56,7 +56,7 @@ class RequestNotifier(base.Middleware):
         return _factory
 
     def __init__(self, app, **conf):
-        self.service_name = conf.get('service_name', None)
+        self.service_name = conf.get('service_name')
         self.ignore_req_list = [x.upper().strip() for x in
                                 conf.get('ignore_req_list', '').split(',')]
         super(RequestNotifier, self).__init__(app)
@@ -68,7 +68,7 @@ class RequestNotifier(base.Middleware):
 
         """
         return dict((k, v) for k, v in six.iteritems(environ)
-                    if k.isupper())
+                    if k.isupper() and k != 'HTTP_X_AUTH_TOKEN')
 
     @log_and_ignore_error
     def process_request(self, request):