diff options
author | Yaroslav Halchenko <debian@onerussian.com> | 2015-09-23 12:13:52 -0400 |
---|---|---|
committer | Yaroslav Halchenko <debian@onerussian.com> | 2015-09-23 12:13:52 -0400 |
commit | 8cf614e2219c999564ce669c5ce0dc29364acb29 (patch) | |
tree | e117fbbcc531fb60794a6cab16feba5dee256125 /fail2ban/helpers.py | |
parent | 24f875ad3ed550ae380e9c63ad145cb662ff6ba8 (diff) | |
download | fail2ban-8cf614e2219c999564ce669c5ce0dc29364acb29.tar.gz |
ENH: allow to split ignoreip by space and/or comma (Closes #1197)
Way too many people ran into this gotcha, so lets just do it
Diffstat (limited to 'fail2ban/helpers.py')
-rw-r--r-- | fail2ban/helpers.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fail2ban/helpers.py b/fail2ban/helpers.py index f5c3163a..8e1b0e32 100644 --- a/fail2ban/helpers.py +++ b/fail2ban/helpers.py @@ -127,3 +127,13 @@ def excepthook(exctype, value, traceback): getLogger("fail2ban").critical( "Unhandled exception in Fail2Ban:", exc_info=True) return sys.__excepthook__(exctype, value, traceback) + +def splitcommaspace(s): + """Helper to split on any comma or space + + Returns empty list if input is empty (or None) and filters + out empty entries + """ + if not s: + return [] + return filter(bool, re.split('[ ,]', s)) |