From a527fbcae55259fd40851e56f2a88ecf6cfd6247 Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 6 Jan 2020 21:37:55 +0100 Subject: [PATCH] small amend: if not on-demand, the families should be specified (or default), also avoids error "dictionary changed size during iteration" --- fail2ban/server/action.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/fail2ban/server/action.py b/fail2ban/server/action.py index 0c3bbf2a..b825bb96 100644 --- a/fail2ban/server/action.py +++ b/fail2ban/server/action.py @@ -440,18 +440,14 @@ class CommandAction(ActionBase): @property def _hasCondSection(self): v = self._properties.get('__hasCondSection') - if v is None: - v = False - famset = set() - for n in self._properties: - grp = CONDITIONAL_FAM_RE.match(n) - if grp: - self._properties['__hasCondSection'] = v = True - if self._properties.get('families') or self._startOnDemand: - break - famset.add(grp.group(2)) - self._properties['__families'] = famset - self._properties['__hasCondSection'] = v + if v is not None: + return v + v = False + for n in self._properties: + if CONDITIONAL_FAM_RE.match(n): + v = True + break + self._properties['__hasCondSection'] = v return v @property