]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Fix install_except_hook()
authorZack Cerza <zack@cerza.org>
Thu, 10 Jul 2014 22:17:25 +0000 (16:17 -0600)
committerZack Cerza <zack@cerza.org>
Thu, 10 Jul 2014 22:17:25 +0000 (16:17 -0600)
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/worker.py

index e35a11d37e4b7584d136e73c0ef1f7e97d669c1e..956e4ec6dcd0bebaaca0448654880647082c080c 100644 (file)
@@ -46,15 +46,11 @@ def install_except_hook():
     Install an exception hook that first logs any uncaught exception, then
     raises it.
     """
-    def log_exception(exception_class, exception, traceback):
-        logging.critical(''.join(format_tb(traceback)))
-        if not exception.message:
-            logging.critical(exception_class.__name__)
-        else:
-            logging.critical('{0}: {1}'.format(
-                exception_class.__name__, exception))
-        # Now raise the exception like normal
-        sys.__excepthook__(exception_class, exception, traceback)
+    def log_exception(exc_type, exc_value, exc_traceback):
+        if not issubclass(exc_type, KeyboardInterrupt):
+            log.critical("Uncaught exception", exc_info=(exc_type, exc_value,
+                                                         exc_traceback))
+        sys.__excepthook__(exc_type, exc_value, exc_traceback)
     sys.excepthook = log_exception