Task 3: remove config_file_service facade, update direct imports and tests

This commit is contained in:
2026-04-15 21:16:00 +02:00
parent 0e22d1c425
commit cdb0c3681e
10 changed files with 385 additions and 1580 deletions

View File

@@ -19,7 +19,8 @@ from app.models.config import (
RegexTestResponse,
ServiceStatusResponse,
)
from app.services import config_file_service, config_service, jail_service, log_service, setup_service
from app.services import config_service, jail_service, log_service, setup_service
from app.utils.config_file_utils import start_daemon, wait_for_fail2ban
from app.exceptions import Fail2BanConnectionError
log: structlog.stdlib.BoundLogger = structlog.get_logger()
@@ -191,10 +192,10 @@ async def restart_fail2ban(
raise _bad_gateway(exc) from exc
# Step 2: start the daemon via subprocess.
await config_file_service.start_daemon(start_cmd_parts)
await start_daemon(start_cmd_parts)
# Step 3: probe the socket until fail2ban is responsive or the budget expires.
fail2ban_running: bool = await config_file_service.wait_for_fail2ban(socket_path, max_wait_seconds=10.0)
fail2ban_running: bool = await wait_for_fail2ban(socket_path, max_wait_seconds=10.0)
if not fail2ban_running:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,