mirror of https://github.com/fail2ban/fail2ban
command-line: test config shall output error directly and not using logger
parent
d02a613e89
commit
b0d4eb07e5
|
@ -406,6 +406,8 @@ class Fail2banClient(Fail2banCmdLine, Thread):
|
||||||
if ret is not None:
|
if ret is not None:
|
||||||
if ret:
|
if ret:
|
||||||
return True
|
return True
|
||||||
|
if self._conf.get("test", False) and not self._args: # test only
|
||||||
|
return False
|
||||||
raise ServerExecutionException("Init of command line failed")
|
raise ServerExecutionException("Init of command line failed")
|
||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
|
|
|
@ -260,12 +260,15 @@ class Fail2banCmdLine():
|
||||||
if readcfg:
|
if readcfg:
|
||||||
readcfg = False
|
readcfg = False
|
||||||
ret, stream = self.readConfig()
|
ret, stream = self.readConfig()
|
||||||
if not ret:
|
|
||||||
raise ServerExecutionException("ERROR: test configuration failed")
|
|
||||||
# exit after test if no commands specified (test only):
|
# exit after test if no commands specified (test only):
|
||||||
if not len(self._args):
|
if not len(self._args):
|
||||||
output("OK: configuration test is successful")
|
if ret:
|
||||||
|
output("OK: configuration test is successful")
|
||||||
|
else:
|
||||||
|
output("ERROR: test configuration failed")
|
||||||
return ret
|
return ret
|
||||||
|
if not ret:
|
||||||
|
raise ServerExecutionException("ERROR: test configuration failed")
|
||||||
|
|
||||||
# Nothing to do here, process in client/server
|
# Nothing to do here, process in client/server
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in New Issue