- 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
0.5
Cyril Jaquier 19 years ago
parent 5556c78350
commit 1d09db666d

@ -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

Loading…
Cancel
Save