"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "fail2ban/tests/dummyjail.py" between
fail2ban-0.10.5.tar.gz and fail2ban-0.11.1.tar.gz

About:

dummyjail.py  (fail2ban-0.10.5):dummyjail.py  (fail2ban-0.11.1)
skipping to change at line 30 skipping to change at line 30
# Fail2Ban developers # Fail2Ban developers
__copyright__ = "Copyright (c) 2012 Yaroslav Halchenko" __copyright__ = "Copyright (c) 2012 Yaroslav Halchenko"
__license__ = "GPL" __license__ = "GPL"
from threading import Lock from threading import Lock
from ..server.jail import Jail from ..server.jail import Jail
from ..server.actions import Actions from ..server.actions import Actions
class DummyActions(Actions):
def checkBan(self):
return self._Actions__checkBan()
class DummyJail(Jail): class DummyJail(Jail):
"""A simple 'jail' to suck in all the tickets generated by Filter's """A simple 'jail' to suck in all the tickets generated by Filter's
""" """
def __init__(self, backend=None): def __init__(self, name='DummyJail', backend=None):
self.lock = Lock() self.lock = Lock()
self.queue = [] self.queue = []
super(DummyJail, self).__init__(name='DummyJail', backend=backend ) super(DummyJail, self).__init__(name=name, backend=backend)
self.__db = None self.__db = None
self.__actions = Actions(self) self.__actions = DummyActions(self)
def __len__(self): def __len__(self):
with self.lock: with self.lock:
return len(self.queue) return len(self.queue)
def isEmpty(self): def isEmpty(self):
with self.lock: with self.lock:
return not self.queue return not self.queue
def isFilled(self): def isFilled(self):
skipping to change at line 64 skipping to change at line 68
self.queue.append(ticket) self.queue.append(ticket)
def getFailTicket(self): def getFailTicket(self):
with self.lock: with self.lock:
try: try:
return self.queue.pop() return self.queue.pop()
except IndexError: except IndexError:
return False return False
@property @property
def name(self):
return "DummyJail #%s with %d tickets" % (id(self), len(self))
@property
def idle(self): def idle(self):
return False; return False;
@idle.setter @idle.setter
def idle(self, value): def idle(self, value):
pass pass
@property @property
def database(self): def database(self):
return self.__db; return self.__db;
 End of changes. 5 change blocks. 
7 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)