Browse Source

fail2ban-testcases: added option "--ignore": negate [regexps] filter, to ignore tests matched specified regexps

pull/1346/head
sebres 9 years ago
parent
commit
134c33cc6d
  1. 3
      bin/fail2ban-testcases
  2. 4
      fail2ban/tests/utils.py

3
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',

4
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:

Loading…
Cancel
Save