feat: config file parser + writer utilities with full test coverage (Tasks 4.1, 4.2)

- Fail2BanConfigParser class: merge order, include directives (before/after),
  variable interpolation %(var)s, split_multiline, ordered_conf_files
- config_writer: write_local_override, remove_local_key, delete_local_file
  with atomic writes (os.replace), per-file threading locks, .local-only guard
- 79 tests in tests/test_utils/ (all passing)
- mypy --strict: 60 source files, 0 errors
- ruff: all checks passed
This commit is contained in:
2026-03-13 19:38:03 +01:00
parent 6e35c5d269
commit 6e4797d71e
6 changed files with 1427 additions and 3 deletions

View File

@@ -253,7 +253,7 @@ fail2ban ships with many action definitions in `action.d/` (iptables, firewalld,
---
### Task 3.3 — Frontend: Actions Tab with Active/Inactive Display and Activation
### Task 3.3 — Frontend: Actions Tab with Active/Inactive Display and Activation ✅ DONE
**Goal:** Enhance the Actions tab in the Configuration page to show all actions with active/inactive status and allow editing and assignment.
@@ -300,7 +300,7 @@ fail2ban ships with many action definitions in `action.d/` (iptables, firewalld,
## Stage 4 — Unified Config File Service and Shared Utilities
### Task 4.1 — Config File Parser Utility
### Task 4.1 — Config File Parser Utility ✅ DONE
**Goal:** Build a robust, reusable parser for fail2ban INI-style config files that all config-related features share.
@@ -324,7 +324,7 @@ fail2ban ships with many action definitions in `action.d/` (iptables, firewalld,
---
### Task 4.2 — Config File Writer Utility
### Task 4.2 — Config File Writer Utility ✅ DONE
**Goal:** Build a safe writer utility for creating and updating `.local` override files.