mirror of https://github.com/fail2ban/fail2ban
commit
034a865c79
|
@ -296,7 +296,7 @@ class Actions(JailThread, Mapping):
|
||||||
True if an IP address get banned.
|
True if an IP address get banned.
|
||||||
"""
|
"""
|
||||||
ticket = self._jail.getFailTicket()
|
ticket = self._jail.getFailTicket()
|
||||||
if ticket != False:
|
if ticket:
|
||||||
aInfo = CallingMap()
|
aInfo = CallingMap()
|
||||||
bTicket = BanManager.createBanTicket(ticket)
|
bTicket = BanManager.createBanTicket(ticket)
|
||||||
ip = bTicket.getIP()
|
ip = bTicket.getIP()
|
||||||
|
|
|
@ -306,7 +306,7 @@ class DatabaseTest(LogCaptureTestCase):
|
||||||
def testActionWithDB(self):
|
def testActionWithDB(self):
|
||||||
# test action together with database functionality
|
# test action together with database functionality
|
||||||
self.testAddJail() # Jail required
|
self.testAddJail() # Jail required
|
||||||
self.jail.database = self.db;
|
self.jail.database = self.db
|
||||||
actions = Actions(self.jail)
|
actions = Actions(self.jail)
|
||||||
actions.add(
|
actions.add(
|
||||||
"action_checkainfo",
|
"action_checkainfo",
|
||||||
|
|
|
@ -101,7 +101,7 @@ class AddFailure(unittest.TestCase):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
ticket_repr,
|
ticket_repr,
|
||||||
'FailTicket: ip=193.168.0.128 time=1167605999.0 #attempts=5 matches=[]')
|
'FailTicket: ip=193.168.0.128 time=1167605999.0 #attempts=5 matches=[]')
|
||||||
self.assertFalse(ticket == False)
|
self.assertFalse(not ticket)
|
||||||
# and some get/set-ers otherwise not tested
|
# and some get/set-ers otherwise not tested
|
||||||
ticket.setTime(1000002000.0)
|
ticket.setTime(1000002000.0)
|
||||||
self.assertEqual(ticket.getTime(), 1000002000.0)
|
self.assertEqual(ticket.getTime(), 1000002000.0)
|
||||||
|
|
|
@ -67,7 +67,8 @@ class SetupTest(unittest.TestCase):
|
||||||
" -- cannot locate setup.py")
|
" -- cannot locate setup.py")
|
||||||
|
|
||||||
def testSetupInstallRoot(self):
|
def testSetupInstallRoot(self):
|
||||||
if not self.setup: return # if verbose skip didn't work out
|
if not self.setup:
|
||||||
|
return # if verbose skip didn't work out
|
||||||
tmp = tempfile.mkdtemp()
|
tmp = tempfile.mkdtemp()
|
||||||
try:
|
try:
|
||||||
os.system("%s %s install --root=%s >/dev/null"
|
os.system("%s %s install --root=%s >/dev/null"
|
||||||
|
@ -138,8 +139,10 @@ class TestsUtilsTest(unittest.TestCase):
|
||||||
raise ValueError()
|
raise ValueError()
|
||||||
|
|
||||||
def deep_function(i):
|
def deep_function(i):
|
||||||
if i: deep_function(i-1)
|
if i:
|
||||||
else: func_raise()
|
deep_function(i-1)
|
||||||
|
else:
|
||||||
|
func_raise()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print deep_function(3)
|
print deep_function(3)
|
||||||
|
|
Loading…
Reference in New Issue