test cases extended (now correct)

pull/868/head
sebres 2014-11-28 04:02:44 +01:00 committed by sebres
parent cad09d2df3
commit 1439152121
4 changed files with 29 additions and 2 deletions

View File

@ -14,8 +14,8 @@ ver. 0.9.2 (2014/XX/XXX) - wanna-be-released
* $ typo in jail.conf. Thanks Skibbi. Debian bug #767255
* grep'ing for IP in *mail-whois-lines.conf should now match also
at the begginning and EOL. Thanks Dean Lee
* failregex declared in jail was joined to single line (specifying of multiple
expressions was not possible).
* failregex declared direct in jail was joined to single line (specifying of
multiple expressions was not possible).
- New Features:

View File

@ -50,6 +50,8 @@ class FilterReader(DefinitionInitConfigReader):
def convert(self):
stream = list()
combinedopts = dict(list(self._opts.items()) + list(self._initOpts.items()))
if not len(combinedopts):
return stream;
opts = CommandAction.substituteRecursiveTags(combinedopts)
if not opts:
raise ValueError('recursive tag definitions unable to be resolved')

View File

@ -425,6 +425,17 @@ class JailsReaderTest(LogCaptureTestCase):
self.maxDiff = None
self.assertEqual(sorted(comm_commands),
sorted([['add', 'emptyaction', 'auto'],
['add', 'test1addfailregex', 'auto'],
['set', 'test1addfailregex', 'addfailregex', 'failure 1 <HOST>'],
['set', 'test1addfailregex', 'addfailregex', 'failure 2 <HOST>'],
['set', 'test1addfailregex', 'addignoreregex', 'ignore 1 <HOST>'],
['set', 'test1addfailregex', 'addignoreregex', 'ignore 2 <HOST>'],
['set', 'test1addfailregex', 'addfailregex', '<IP>'],
['start', 'test1addfailregex'],
['add', 'test2failregex', 'auto'],
['set', 'test2failregex', 'addfailregex', 'failure 1 <IP>'],
['set', 'test2failregex', 'addfailregex', 'failure 2 <IP>'],
['start', 'test2failregex'],
['add', 'missinglogfiles', 'auto'],
['set', 'missinglogfiles', 'addfailregex', '<IP>'],
['add', 'brokenaction', 'auto'],

View File

@ -13,6 +13,20 @@ failregex = <IP>
ignoreregex =
ignoreip =
[test1addfailregex]
enabled = true
filter = simple
addfailregex = failure 1 <HOST>
failure 2 <HOST>
addignoreregex = ignore 1 <HOST>
ignore 2 <HOST>
[test2failregex]
enabled = true
filter = simple
failregex = failure 1 <IP>
failure 2 <IP>
[missinglogfiles]
enabled = true
logpath = /weapons/of/mass/destruction