mirror of https://github.com/fail2ban/fail2ban
- Better output when server is not started
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@342 a942ae1a-1317-0410-a47c-b1dcaea8d6050.x
parent
8df771ce6b
commit
b38e0dfb1e
|
@ -25,7 +25,8 @@ __date__ = "$Date$"
|
||||||
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
||||||
__license__ = "GPL"
|
__license__ = "GPL"
|
||||||
|
|
||||||
import sys, string, os, pickle, re, logging, getopt, time, readline, shlex
|
import sys, string, os, pickle, re, logging
|
||||||
|
import getopt, time, readline, shlex, socket
|
||||||
|
|
||||||
# Inserts our own modules path first in the list
|
# Inserts our own modules path first in the list
|
||||||
# fix for bug #343821
|
# fix for bug #343821
|
||||||
|
@ -132,11 +133,6 @@ class Fail2banClient:
|
||||||
beautifier.setInputCmd(c)
|
beautifier.setInputCmd(c)
|
||||||
try:
|
try:
|
||||||
client = CSocket()
|
client = CSocket()
|
||||||
except Exception, e:
|
|
||||||
if showRet:
|
|
||||||
logSys.error(e)
|
|
||||||
logSys.error("Arrggh... Start the server first")
|
|
||||||
return False
|
|
||||||
ret = client.send(c)
|
ret = client.send(c)
|
||||||
if ret[0] == 0:
|
if ret[0] == 0:
|
||||||
logSys.debug("OK : " + `ret[1]`)
|
logSys.debug("OK : " + `ret[1]`)
|
||||||
|
@ -146,6 +142,14 @@ class Fail2banClient:
|
||||||
logSys.debug("NOK: " + `ret[1].args`)
|
logSys.debug("NOK: " + `ret[1].args`)
|
||||||
print beautifier.beautifyError(ret[1])
|
print beautifier.beautifyError(ret[1])
|
||||||
return False
|
return False
|
||||||
|
except socket.error:
|
||||||
|
logSys.error("Unable to contact server. Is it running?")
|
||||||
|
return False
|
||||||
|
except Exception, e:
|
||||||
|
if showRet:
|
||||||
|
logSys.error(e)
|
||||||
|
logSys.error("Arrggh... Start the server first")
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -181,11 +185,6 @@ class Fail2banClient:
|
||||||
else:
|
else:
|
||||||
logSys.error("Could not find server")
|
logSys.error("Could not find server")
|
||||||
return False
|
return False
|
||||||
elif len(cmd) == 1 and cmd[0] == "stop":
|
|
||||||
# Workaround for the shutdown
|
|
||||||
ret = self.processCmd([cmd])
|
|
||||||
self.ping()
|
|
||||||
return ret
|
|
||||||
else:
|
else:
|
||||||
return self.processCmd([cmd])
|
return self.processCmd([cmd])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue