mirror of https://github.com/fail2ban/fail2ban
gh-actions: coverage for systemd backend (to monitor journals in test-suite in GHA-env we need to use 0 as default flags, because otherwise it cannot be found using SYSTEM_ONLY(4))
parent
1bcb62e31c
commit
a147a8b0e1
|
@ -44,6 +44,8 @@ jobs:
|
|||
F2B_PY=${F2B_PY:0:1}
|
||||
echo "Set F2B_PY=$F2B_PY"
|
||||
echo "F2B_PY=$F2B_PY" >> $GITHUB_ENV
|
||||
# for GHA we need to monitor all journals, since it cannot be found using SYSTEM_ONLY(4):
|
||||
echo "F2B_SYSTEMD_DEFAULT_FLAGS=0" >> $GITHUB_ENV
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
|
@ -71,13 +73,13 @@ jobs:
|
|||
_debug '- systemd:' python -c 'from fail2ban.server.filtersystemd import FilterSystemd'
|
||||
#_debug '- systemd (root): ' sudo python -c 'from fail2ban.server.filtersystemd import FilterSystemd'
|
||||
_debug '- pyinotify:' python -c 'from fail2ban.server.filterpyinotify import FilterPyinotify'
|
||||
|
||||
# - name: Test suite
|
||||
# run: if [[ "$F2B_PY" = 2 ]]; then python setup.py test; else python bin/fail2ban-testcases --verbosity=2; fi
|
||||
|
||||
- name: Test suite (debug some systemd tests only)
|
||||
# run: python bin/fail2ban-testcases --verbosity=2 "[sS]ystemd|[jJ]ournal"
|
||||
run: python bin/fail2ban-testcases --verbosity=2 -l 5 "test_WrongChar"
|
||||
- name: Test suite
|
||||
run: if [[ "$F2B_PY" = 2 ]]; then python setup.py test; else python bin/fail2ban-testcases --verbosity=2; fi
|
||||
|
||||
#- name: Test suite (debug some systemd tests only)
|
||||
#run: python bin/fail2ban-testcases --verbosity=2 "[sS]ystemd|[jJ]ournal"
|
||||
#run: python bin/fail2ban-testcases --verbosity=2 -l 5 "test_WrongChar"
|
||||
|
||||
- name: Build
|
||||
run: python setup.py build
|
||||
|
|
|
@ -23,6 +23,7 @@ __copyright__ = "Copyright (c) 2013 Steven Hiscocks"
|
|||
__license__ = "GPL"
|
||||
|
||||
import datetime
|
||||
import os
|
||||
import time
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
|
@ -93,7 +94,7 @@ class FilterSystemd(JournalFilter): # pragma: systemd no cover
|
|||
except KeyError:
|
||||
# be sure all journal types will be opened if files/path specified (don't set flags):
|
||||
if ('files' not in args or not len(args['files'])) and ('path' not in args or not args['path']):
|
||||
args['flags'] = 4
|
||||
args['flags'] = int(os.getenv("F2B_SYSTEMD_DEFAULT_FLAGS", 4))
|
||||
|
||||
try:
|
||||
args['namespace'] = kwargs.pop('namespace')
|
||||
|
|
Loading…
Reference in New Issue