Move service-dependent helper wrappers from app.utils to app.helpers and update config router activation/rollback to use explicit AppState dependency.
24 lines
679 B
Python
24 lines
679 B
Python
"""Shared jail management helpers for service-layer code."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from app.services.jail_service import reload_all
|
|
|
|
if TYPE_CHECKING:
|
|
from collections.abc import Sequence
|
|
|
|
|
|
async def reload_jails(
|
|
socket_path: str,
|
|
include_jails: Sequence[str] | None = None,
|
|
exclude_jails: Sequence[str] | None = None,
|
|
) -> None:
|
|
"""Reload fail2ban jails using the shared jail service helper."""
|
|
await reload_all(
|
|
socket_path,
|
|
include_jails=list(include_jails) if include_jails is not None else None,
|
|
exclude_jails=list(exclude_jails) if exclude_jails is not None else None,
|
|
)
|