From 8ae834379a4f45838c61bdcd0b8c9948fba6fcca Mon Sep 17 00:00:00 2001 From: Ernesto Puerta Date: Tue, 22 Mar 2022 14:40:30 +0100 Subject: [PATCH] mgr/dashboard: don't log 3xx as errors Let's avoid printing these ugly/misleading/redundant messages: ``` 0 [dashboard DEBUG controllers.home] frontend language from headers: ['en-us'] 0 [dashboard DEBUG controllers.home] found directory for language 'en-us' 0 [dashboard DEBUG controllers.home] serving static content: /home/jenkins-build/build/workspace/ceph-dashboard-pull-requests/build/src/pybind/mgr/dashboard/frontend/dist/en-US/styles.css 0 [dashboard ERROR exception] Internal Server Error Traceback (most recent call last): File "/home/jenkins-build/build/workspace/ceph-dashboard-pull-requests/src/pybind/mgr/dashboard/services/exception.py", line 47, in dashboard_exception_handler return handler(*args, **kwargs) File "/usr/lib/python3/dist-packages/cherrypy/_cpdispatch.py", line 60, in __call__ return self.callable(*self.args, **self.kwargs) File "/home/jenkins-build/build/workspace/ceph-dashboard-pull-requests/src/pybind/mgr/dashboard/controllers/home.py", line 134, in __call__ return serve_file(full_path) File "/usr/lib/python3/dist-packages/cherrypy/lib/static.py", line 70, in serve_file cptools.validate_since() File "/usr/lib/python3/dist-packages/cherrypy/lib/cptools.py", line 117, in validate_since raise cherrypy.HTTPRedirect([], 304) cherrypy._cperror.HTTPRedirect: ([], 304) ``` Fixes: https://tracker.ceph.com/issues/54991 Signed-off-by: Ernesto Puerta (cherry picked from commit 406e54d8c41bbc94b7285077d3055766629a2313) --- src/pybind/mgr/dashboard/services/exception.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pybind/mgr/dashboard/services/exception.py b/src/pybind/mgr/dashboard/services/exception.py index 4ec9ffce2ee22..c280e17d4371b 100644 --- a/src/pybind/mgr/dashboard/services/exception.py +++ b/src/pybind/mgr/dashboard/services/exception.py @@ -51,6 +51,9 @@ def dashboard_exception_handler(handler, *args, **kwargs): cherrypy.response.headers['Content-Type'] = 'application/json' cherrypy.response.status = getattr(error, 'status', 400) return json.dumps(serialize_dashboard_exception(error)).encode('utf-8') + except cherrypy.HTTPRedirect: + # No internal errors + raise except Exception as error: logger.exception('Internal Server Error') raise error -- 2.39.5