From 1d09db666d4bfa8914feeeb62bf767d794bec952 Mon Sep 17 00:00:00 2001 From: Cyril Jaquier Date: Wed, 26 Oct 2005 21:51:52 +0000 Subject: [PATCH] - Added "ExternalError" exception - Raise "ExternalError" exception in "executeCmd()" if "system()" fails git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_5@207 a942ae1a-1317-0410-a47c-b1dcaea8d605 --- utils/process.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils/process.py b/utils/process.py index 03650212..b310f090 100644 --- a/utils/process.py +++ b/utils/process.py @@ -29,6 +29,11 @@ import os, logging, signal # Gets the instance of the logger. logSys = logging.getLogger("fail2ban") +class ExternalError(UserWarning): + """ Exception to warn about failed fwcheck or fwban command + """ + pass + def createDaemon(): """ Detach a process from the controlling terminal and run it in the background as a daemon. @@ -126,6 +131,7 @@ def executeCmd(cmd, debug): retval = os.system(cmd) if not retval == 0: logSys.error("'" + cmd + "' returned " + `retval`) + raise ExternalError("Execution of command '%s' failed" % cmd) return retval else: return None