fixed tests
This commit is contained in:
@@ -37,7 +37,6 @@ from app.services import (
|
||||
filter_config_service,
|
||||
jail_config_service,
|
||||
)
|
||||
from app.utils.path_utils import validate_log_path
|
||||
from app.utils.constants import (
|
||||
RATE_LIMIT_JAIL_ACTIVATE_REQUESTS,
|
||||
RATE_LIMIT_JAIL_CREATE_REQUESTS,
|
||||
@@ -45,6 +44,7 @@ from app.utils.constants import (
|
||||
RATE_LIMIT_JAIL_DELETE_REQUESTS,
|
||||
RATE_LIMIT_JAIL_UPDATE_REQUESTS,
|
||||
)
|
||||
from app.utils.path_utils import validate_log_path
|
||||
from app.utils.runtime_state import (
|
||||
clear_activation_record,
|
||||
clear_pending_recovery,
|
||||
@@ -207,7 +207,8 @@ def _check_jail_deactivate_rate_limit(
|
||||
)
|
||||
|
||||
|
||||
_NamePath = Annotated[str, Path(description='Jail name as configured in fail2ban.')]
|
||||
_NamePath = Annotated[str, Path(description="Jail name as configured in fail2ban.")]
|
||||
|
||||
|
||||
@router.get(
|
||||
"",
|
||||
@@ -240,8 +241,6 @@ async def get_jail_configs(
|
||||
return config_mappers.map_domain_jail_config_list_to_response(domain_result)
|
||||
|
||||
|
||||
|
||||
|
||||
@router.get(
|
||||
"/inactive",
|
||||
response_model=InactiveJailListResponse,
|
||||
@@ -335,9 +334,8 @@ async def get_jail_config(
|
||||
HTTPException: 502 when fail2ban is unreachable.
|
||||
"""
|
||||
domain_result = await config_service.get_jail_config(socket_path, name)
|
||||
return config_mappers.map_domain_jail_config_to_response(domain_result)
|
||||
|
||||
|
||||
mapped = config_mappers.map_domain_jail_config_to_response(domain_result)
|
||||
return JailConfigResponse(jail=mapped)
|
||||
|
||||
|
||||
@router.put(
|
||||
@@ -387,8 +385,6 @@ async def update_jail_config(
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
@router.post(
|
||||
"/{name}/logpath",
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
@@ -430,8 +426,6 @@ async def add_log_path(
|
||||
await config_service.add_log_path(socket_path, name, body)
|
||||
|
||||
|
||||
|
||||
|
||||
@router.delete(
|
||||
"/{name}/logpath",
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
@@ -479,8 +473,6 @@ async def delete_log_path(
|
||||
await config_service.delete_log_path(socket_path, name, log_path)
|
||||
|
||||
|
||||
|
||||
|
||||
@router.post(
|
||||
"/{name}/activate",
|
||||
response_model=JailActivationResponse,
|
||||
@@ -532,9 +524,7 @@ async def activate_jail(
|
||||
"""
|
||||
req = body if body is not None else ActivateJailRequest()
|
||||
|
||||
result = await jail_config_service.activate_jail(
|
||||
config_dir, socket_path, name, req, health_probe=health_probe
|
||||
)
|
||||
result = await jail_config_service.activate_jail(config_dir, socket_path, name, req, health_probe=health_probe)
|
||||
|
||||
if result.active:
|
||||
record_activation(app, name)
|
||||
@@ -542,8 +532,6 @@ async def activate_jail(
|
||||
return result
|
||||
|
||||
|
||||
|
||||
|
||||
@router.post(
|
||||
"/{name}/deactivate",
|
||||
response_model=JailActivationResponse,
|
||||
@@ -588,14 +576,10 @@ async def deactivate_jail(
|
||||
HTTPException: 502 if fail2ban is unreachable.
|
||||
"""
|
||||
|
||||
result = await jail_config_service.deactivate_jail(
|
||||
config_dir, socket_path, name, health_probe=health_probe
|
||||
)
|
||||
result = await jail_config_service.deactivate_jail(config_dir, socket_path, name, health_probe=health_probe)
|
||||
return result
|
||||
|
||||
|
||||
|
||||
|
||||
@router.delete(
|
||||
"/{name}/local",
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
@@ -645,8 +629,6 @@ async def delete_jail_local_override(
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
@router.post(
|
||||
"/{name}/validate",
|
||||
response_model=JailValidationResult,
|
||||
@@ -868,10 +850,8 @@ async def remove_action_from_jail(
|
||||
action_name,
|
||||
do_reload=reload,
|
||||
)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Filter discovery endpoints (Task 2.1)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user