From 9764c78415e7776c0cffdd306e29180336ef9f35 Mon Sep 17 00:00:00 2001 From: Steven Hiscocks Date: Tue, 10 Jun 2014 20:38:18 +0100 Subject: [PATCH] ENH: Rename fail2ban_excepthook to excepthook --- fail2ban/helpers.py | 2 +- fail2ban/server/jailthread.py | 4 ++-- fail2ban/server/server.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fail2ban/helpers.py b/fail2ban/helpers.py index 2c810878..7ba8a72a 100644 --- a/fail2ban/helpers.py +++ b/fail2ban/helpers.py @@ -113,7 +113,7 @@ def getLogger(name): """ return logging.getLogger("fail2ban.%s" % name.rpartition(".")[-1]) -def fail2ban_excepthook(exctype, value, traceback): +def excepthook(exctype, value, traceback): """Except hook used to log unhandled exceptions to Fail2Ban log """ getLogger("fail2ban").critical( diff --git a/fail2ban/server/jailthread.py b/fail2ban/server/jailthread.py index 4f640f8b..2627cebf 100644 --- a/fail2ban/server/jailthread.py +++ b/fail2ban/server/jailthread.py @@ -28,7 +28,7 @@ import sys from threading import Thread from abc import abstractproperty, abstractmethod -from ..helpers import fail2ban_excepthook +from ..helpers import excepthook class JailThread(Thread): """Abstract class for threading elements in Fail2Ban. @@ -63,7 +63,7 @@ class JailThread(Thread): try: run(*args, **kwargs) except: - fail2ban_excepthook(*sys.exc_info()) + excepthook(*sys.exc_info()) self.run = run_with_except_hook @abstractproperty diff --git a/fail2ban/server/server.py b/fail2ban/server/server.py index 8efb2c59..02f3423b 100644 --- a/fail2ban/server/server.py +++ b/fail2ban/server/server.py @@ -32,7 +32,7 @@ from .filter import FileFilter, JournalFilter from .transmitter import Transmitter from .asyncserver import AsyncServer, AsyncServerException from .. import version -from ..helpers import getLogger, fail2ban_excepthook +from ..helpers import getLogger, excepthook # Gets the instance of the logger. logSys = getLogger(__name__) @@ -71,7 +71,7 @@ class Server: signal.signal(signal.SIGINT, self.__sigTERMhandler) # Ensure unhandled exceptions are logged - sys.excepthook = fail2ban_excepthook + sys.excepthook = excepthook # First set the mask to only allow access to owner os.umask(0077)