Refactor backend services and jail configuration
- Refactor action_config_service, filter_config_service, jail_config_service, and jail_service - Add jail_socket utility module for socket communication - Update test_jail_service with new test cases - Update architecture and task documentation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -25,13 +25,6 @@ from app.exceptions import (
|
||||
ConfigWriteError,
|
||||
JailNotFoundInConfigError,
|
||||
)
|
||||
import app.services.jail_service as jail_service
|
||||
from app.utils.config_file_utils import (
|
||||
_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,
|
||||
)
|
||||
from app.models.config import (
|
||||
ActionConfig,
|
||||
ActionConfigUpdate,
|
||||
@@ -42,6 +35,17 @@ from app.models.config import (
|
||||
)
|
||||
from app.utils import conffile_parser
|
||||
from app.utils.async_utils import run_blocking
|
||||
from app.utils.config_file_utils import (
|
||||
_get_active_jail_names as _config_file_get_active_jail_names,
|
||||
)
|
||||
from app.utils.config_file_utils import (
|
||||
_parse_jails_sync as _config_file_parse_jails_sync,
|
||||
)
|
||||
from app.utils.config_file_utils import (
|
||||
_safe_jail_name,
|
||||
build_parser,
|
||||
)
|
||||
from app.utils.jail_socket import reload_all
|
||||
|
||||
log: structlog.stdlib.BoundLogger = structlog.get_logger()
|
||||
|
||||
@@ -681,7 +685,7 @@ async def update_action(
|
||||
|
||||
if do_reload:
|
||||
try:
|
||||
await jail_service.reload_all(socket_path)
|
||||
await reload_all(socket_path)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
log.warning(
|
||||
"reload_after_action_update_failed",
|
||||
@@ -749,7 +753,7 @@ async def create_action(
|
||||
|
||||
if do_reload:
|
||||
try:
|
||||
await jail_service.reload_all(socket_path)
|
||||
await reload_all(socket_path)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
log.warning(
|
||||
"reload_after_action_create_failed",
|
||||
@@ -874,7 +878,7 @@ async def assign_action_to_jail(
|
||||
|
||||
if do_reload:
|
||||
try:
|
||||
await jail_service.reload_all(socket_path)
|
||||
await reload_all(socket_path)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
log.warning(
|
||||
"reload_after_assign_action_failed",
|
||||
@@ -932,7 +936,7 @@ async def remove_action_from_jail(
|
||||
|
||||
if do_reload:
|
||||
try:
|
||||
await jail_service.reload_all(socket_path)
|
||||
await reload_all(socket_path)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
log.warning(
|
||||
"reload_after_remove_action_failed",
|
||||
|
||||
Reference in New Issue
Block a user