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}
|
F2B_PY=${F2B_PY:0:1}
|
||||||
echo "Set F2B_PY=$F2B_PY"
|
echo "Set F2B_PY=$F2B_PY"
|
||||||
echo "F2B_PY=$F2B_PY" >> $GITHUB_ENV
|
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
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
|
@ -72,12 +74,12 @@ jobs:
|
||||||
#_debug '- systemd (root): ' sudo 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'
|
_debug '- pyinotify:' python -c 'from fail2ban.server.filterpyinotify import FilterPyinotify'
|
||||||
|
|
||||||
# - name: Test suite
|
- name: Test suite
|
||||||
# run: if [[ "$F2B_PY" = 2 ]]; then python setup.py test; else python bin/fail2ban-testcases --verbosity=2; fi
|
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)
|
#- 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 "[sS]ystemd|[jJ]ournal"
|
||||||
run: python bin/fail2ban-testcases --verbosity=2 -l 5 "test_WrongChar"
|
#run: python bin/fail2ban-testcases --verbosity=2 -l 5 "test_WrongChar"
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: python setup.py build
|
run: python setup.py build
|
||||||
|
|
|
@ -23,6 +23,7 @@ __copyright__ = "Copyright (c) 2013 Steven Hiscocks"
|
||||||
__license__ = "GPL"
|
__license__ = "GPL"
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import os
|
||||||
import time
|
import time
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
|
@ -93,7 +94,7 @@ class FilterSystemd(JournalFilter): # pragma: systemd no cover
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# be sure all journal types will be opened if files/path specified (don't set flags):
|
# 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']):
|
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:
|
try:
|
||||||
args['namespace'] = kwargs.pop('namespace')
|
args['namespace'] = kwargs.pop('namespace')
|
||||||
|
|
Loading…
Reference in New Issue