filter reader stream: don't need to generate None values from filter config

pull/3229/head
sebres 2022-02-11 21:12:59 +01:00
parent b83712e3ec
commit c6e93db278
1 changed files with 2 additions and 3 deletions

View File

@ -72,8 +72,9 @@ class FilterReader(DefinitionInitConfigReader):
def _fillStream(stream, opts, jailName): def _fillStream(stream, opts, jailName):
prio0idx = 0 prio0idx = 0
for opt, value in opts.iteritems(): for opt, value in opts.iteritems():
# Do not send a command if the value is not set (empty).
if value is None: continue
if opt in ("failregex", "ignoreregex"): if opt in ("failregex", "ignoreregex"):
if value is None: continue
multi = [] multi = []
for regex in value.split('\n'): for regex in value.split('\n'):
# Do not send a command if the rule is empty. # Do not send a command if the rule is empty.
@ -91,8 +92,6 @@ class FilterReader(DefinitionInitConfigReader):
elif opt in ('datepattern'): elif opt in ('datepattern'):
stream.append(["set", jailName, opt, value]) stream.append(["set", jailName, opt, value])
elif opt == 'journalmatch': elif opt == 'journalmatch':
# Do not send a command if the match is empty.
if value is None: continue
for match in value.split("\n"): for match in value.split("\n"):
if match == '': continue if match == '': continue
stream.append( stream.append(