Task 3: remove config_file_service facade, update direct imports and tests
This commit is contained in:
@@ -27,8 +27,8 @@ from app.exceptions import (
|
||||
)
|
||||
import app.services.jail_service as jail_service
|
||||
from app.utils.config_file_utils import (
|
||||
_get_active_jail_names,
|
||||
_parse_jails_sync,
|
||||
_get_active_jail_names as _config_file_get_active_jail_names,
|
||||
_parse_jails_sync as _config_file_parse_jails_sync,
|
||||
_safe_jail_name,
|
||||
build_parser,
|
||||
)
|
||||
@@ -50,15 +50,11 @@ log: structlog.stdlib.BoundLogger = structlog.get_logger()
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def _parse_jails_sync(config_dir: Path) -> tuple[dict[str, dict[str, str]], Path]:
|
||||
from app.services import config_file_service
|
||||
|
||||
return config_file_service._parse_jails_sync(config_dir)
|
||||
return _config_file_parse_jails_sync(config_dir)
|
||||
|
||||
|
||||
async def _get_active_jail_names(socket_path: str) -> set[str]:
|
||||
from app.services import config_file_service
|
||||
|
||||
return await config_file_service._get_active_jail_names(socket_path)
|
||||
return await _config_file_get_active_jail_names(socket_path)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -498,8 +494,6 @@ async def list_actions(
|
||||
"""
|
||||
action_d = Path(config_dir) / "action.d"
|
||||
|
||||
from app.services import config_file_service
|
||||
|
||||
raw_actions: list[tuple[str, str, str, bool, str]] = await run_blocking(_parse_actions_sync, action_d)
|
||||
|
||||
all_jails_result, active_names = await asyncio.gather(
|
||||
@@ -687,9 +681,7 @@ async def update_action(
|
||||
|
||||
if do_reload:
|
||||
try:
|
||||
from app.services import config_file_service
|
||||
|
||||
await config_file_service.jail_service.reload_all(socket_path)
|
||||
await jail_service.reload_all(socket_path)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
log.warning(
|
||||
"reload_after_action_update_failed",
|
||||
@@ -757,9 +749,7 @@ async def create_action(
|
||||
|
||||
if do_reload:
|
||||
try:
|
||||
from app.services import config_file_service
|
||||
|
||||
await config_file_service.jail_service.reload_all(socket_path)
|
||||
await jail_service.reload_all(socket_path)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
log.warning(
|
||||
"reload_after_action_create_failed",
|
||||
@@ -884,9 +874,7 @@ async def assign_action_to_jail(
|
||||
|
||||
if do_reload:
|
||||
try:
|
||||
from app.services import config_file_service
|
||||
|
||||
await config_file_service.jail_service.reload_all(socket_path)
|
||||
await jail_service.reload_all(socket_path)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
log.warning(
|
||||
"reload_after_assign_action_failed",
|
||||
@@ -944,9 +932,7 @@ async def remove_action_from_jail(
|
||||
|
||||
if do_reload:
|
||||
try:
|
||||
from app.services import config_file_service
|
||||
|
||||
await config_file_service.jail_service.reload_all(socket_path)
|
||||
await jail_service.reload_all(socket_path)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
log.warning(
|
||||
"reload_after_remove_action_failed",
|
||||
|
||||
Reference in New Issue
Block a user