From c6e93db278005949a69173d268c0a461f2933d6d Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 11 Feb 2022 21:12:59 +0100 Subject: [PATCH] filter reader stream: don't need to generate None values from filter config --- fail2ban/client/filterreader.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fail2ban/client/filterreader.py b/fail2ban/client/filterreader.py index 413f125e..24341014 100644 --- a/fail2ban/client/filterreader.py +++ b/fail2ban/client/filterreader.py @@ -72,8 +72,9 @@ class FilterReader(DefinitionInitConfigReader): def _fillStream(stream, opts, jailName): prio0idx = 0 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 value is None: continue multi = [] for regex in value.split('\n'): # Do not send a command if the rule is empty. @@ -91,8 +92,6 @@ class FilterReader(DefinitionInitConfigReader): elif opt in ('datepattern'): stream.append(["set", jailName, opt, value]) elif opt == 'journalmatch': - # Do not send a command if the match is empty. - if value is None: continue for match in value.split("\n"): if match == '': continue stream.append(