diff --git a/bin/fail2ban-testcases b/bin/fail2ban-testcases index 22a44a8b7..606b0b06b 100755 --- a/bin/fail2ban-testcases +++ b/bin/fail2ban-testcases @@ -67,6 +67,9 @@ def get_opt_parser(): Option('-f', "--fast", action="store_true", dest="fast", help="Try to increase speed of the tests, decreasing of wait intervals, memory database"), + Option('-i', "--ignore", action="store_true", + dest="negate_re", + help="negate [regexps] filter to ignore tests matched specified regexps"), Option("-t", "--log-traceback", action='store_true', help="Enrich log-messages with compressed tracebacks"), Option("--full-traceback", action='store_true', diff --git a/fail2ban/tests/utils.py b/fail2ban/tests/utils.py index 0cac9df5e..ce6d638ad 100644 --- a/fail2ban/tests/utils.py +++ b/fail2ban/tests/utils.py @@ -55,6 +55,7 @@ class F2B(optparse.Values): def __init__(self, opts={}): self.__dict__ = opts.__dict__ if opts else { 'fast': False, 'memory_db':False, 'no_gamin': False, 'no_network': False, + "negate_re": False, } if self.fast: self.memory_db = True @@ -157,7 +158,8 @@ def gatherTests(regexps=None, opts=None): for test in suite: s = str(test) for r in self._regexps: - if r.search(s): + m = r.search(s) + if (m if not opts.negate_re else not m): matched.append(test) break for test in matched: