]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
remove unsupported middleware
authorGordon Chung <gord@live.ca>
Thu, 26 Jun 2014 22:21:32 +0000 (18:21 -0400)
committerGordon Chung <gord@live.ca>
Thu, 26 Jun 2014 22:24:44 +0000 (18:24 -0400)
the audit and notifier middleware from oslo-incubator are not
compatible with oslo.messaging. remove these middleware.

Change-Id: I456c2aa5f24ef977949f589f72d521514d5e97e4

neutron/openstack/common/middleware/audit.py [deleted file]
neutron/openstack/common/middleware/notifier.py [deleted file]
openstack-common.conf

diff --git a/neutron/openstack/common/middleware/audit.py b/neutron/openstack/common/middleware/audit.py
deleted file mode 100644 (file)
index 5d8da52..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (c) 2013 OpenStack Foundation
-# All Rights Reserved.
-#
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
-#    not use this file except in compliance with the License. You may obtain
-#    a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-#    License for the specific language governing permissions and limitations
-#    under the License.
-
-"""
-Attach open standard audit information to request.environ
-
-AuditMiddleware filter should be place after Keystone's auth_token middleware
-in the pipeline so that it can utilise the information Keystone provides.
-
-"""
-from pycadf.audit import api as cadf_api
-
-from neutron.openstack.common.middleware import notifier
-
-
-class AuditMiddleware(notifier.RequestNotifier):
-
-    def __init__(self, app, **conf):
-        super(AuditMiddleware, self).__init__(app, **conf)
-        self.cadf_audit = cadf_api.OpenStackAuditApi()
-
-    @notifier.log_and_ignore_error
-    def process_request(self, request):
-        self.cadf_audit.append_audit_event(request)
-        super(AuditMiddleware, self).process_request(request)
-
-    @notifier.log_and_ignore_error
-    def process_response(self, request, response,
-                         exception=None, traceback=None):
-        self.cadf_audit.mod_audit_event(request, response)
-        super(AuditMiddleware, self).process_response(request, response,
-                                                      exception, traceback)
diff --git a/neutron/openstack/common/middleware/notifier.py b/neutron/openstack/common/middleware/notifier.py
deleted file mode 100644 (file)
index e34699c..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-# Copyright (c) 2013 eNovance
-#
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
-#    not use this file except in compliance with the License. You may obtain
-#    a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-#    License for the specific language governing permissions and limitations
-#    under the License.
-
-"""
-Send notifications on request
-
-"""
-import os.path
-import sys
-import traceback as tb
-
-import six
-import webob.dec
-
-from neutron.openstack.common import context
-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
-
-LOG = logging.getLogger(__name__)
-
-
-def log_and_ignore_error(fn):
-    def wrapped(*args, **kwargs):
-        try:
-            return fn(*args, **kwargs)
-        except Exception as e:
-            LOG.exception(_LE('An exception occurred processing '
-                              'the API call: %s ') % e)
-    return wrapped
-
-
-class RequestNotifier(base.Middleware):
-    """Send notification on request."""
-
-    @classmethod
-    def factory(cls, global_conf, **local_conf):
-        """Factory method for paste.deploy."""
-        conf = global_conf.copy()
-        conf.update(local_conf)
-
-        def _factory(app):
-            return cls(app, **conf)
-        return _factory
-
-    def __init__(self, app, **conf):
-        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)
-
-    @staticmethod
-    def environ_to_dict(environ):
-        """Following PEP 333, server variables are lower case, so don't
-        include them.
-
-        """
-        return dict((k, v) for k, v in six.iteritems(environ)
-                    if k.isupper() and k != 'HTTP_X_AUTH_TOKEN')
-
-    @log_and_ignore_error
-    def process_request(self, request):
-        request.environ['HTTP_X_SERVICE_NAME'] = \
-            self.service_name or request.host
-        payload = {
-            'request': self.environ_to_dict(request.environ),
-        }
-
-        api.notify(context.get_admin_context(),
-                   api.publisher_id(os.path.basename(sys.argv[0])),
-                   'http.request',
-                   api.INFO,
-                   payload)
-
-    @log_and_ignore_error
-    def process_response(self, request, response,
-                         exception=None, traceback=None):
-        payload = {
-            'request': self.environ_to_dict(request.environ),
-        }
-
-        if response:
-            payload['response'] = {
-                'status': response.status,
-                'headers': response.headers,
-            }
-
-        if exception:
-            payload['exception'] = {
-                'value': repr(exception),
-                'traceback': tb.format_tb(traceback)
-            }
-
-        api.notify(context.get_admin_context(),
-                   api.publisher_id(os.path.basename(sys.argv[0])),
-                   'http.response',
-                   api.INFO,
-                   payload)
-
-    @webob.dec.wsgify
-    def __call__(self, req):
-        if req.method in self.ignore_req_list:
-            return req.get_response(self.application)
-        else:
-            self.process_request(req)
-            try:
-                response = req.get_response(self.application)
-            except Exception:
-                exc_type, value, traceback = sys.exc_info()
-                self.process_response(req, None, value, traceback)
-                raise
-            else:
-                self.process_response(req, response)
-            return response
index f6f6fdaf5db5f85ca81139b35b014b2fdc4a7df5..ebd73ccde63d4265b5cb2339e3a143e7be2701bc 100644 (file)
@@ -17,7 +17,12 @@ module=lockutils
 module=log
 module=log_handler
 module=loopingcall
-module=middleware
+module=middleware.base
+module=middleware.catch_errors
+module=middleware.correlation_id
+module=middleware.debug
+module=middleware.request_id
+module=middleware.sizelimit
 module=network_utils
 module=periodic_task
 module=policy