ENH+BF+TST: Filter now returns reference to failregex and ignoreregex

This avoids duplication of code across fail2ban-regex and samples test
cases. This also now more neatly resolves the issue of double counting
date templates matches in fail2ban-regex.
In addition, the samples test cases now also print a warning message
that not all regexs have samples for them, with future plan to change
this to an assertion.
This commit is contained in:
Steven Hiscocks
2013-07-15 22:16:40 +01:00
parent 5bd186b854
commit 1a2b6442a0
5 changed files with 79 additions and 75 deletions

View File

@@ -59,11 +59,12 @@ class DateTemplate:
def getHits(self):
return self.__hits
def incHits(self):
self.__hits += 1
def matchDate(self, line):
dateMatch = self.__cRegex.search(line)
if not dateMatch is None:
self.__hits += 1
return dateMatch
def getDate(self, line):