## 27) Error response body shape is inconsistent
This commit is contained in:
@@ -4,7 +4,7 @@ import shlex
|
||||
from typing import Annotated
|
||||
|
||||
import structlog
|
||||
from fastapi import APIRouter, HTTPException, Query, Request, status
|
||||
from fastapi import APIRouter, Query, Request, status
|
||||
|
||||
from app.dependencies import (
|
||||
AuthDep,
|
||||
@@ -12,6 +12,7 @@ from app.dependencies import (
|
||||
Fail2BanStartCommandDep,
|
||||
SettingsServiceContextDep,
|
||||
)
|
||||
from app.exceptions import OperationError
|
||||
from app.models.config import (
|
||||
Fail2BanLogResponse,
|
||||
GlobalConfigResponse,
|
||||
@@ -158,15 +159,12 @@ async def restart_fail2ban(
|
||||
)
|
||||
|
||||
if not restarted:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
|
||||
detail=(
|
||||
"fail2ban was stopped but did not come back "
|
||||
"online within 10 seconds. "
|
||||
"Check the fail2ban log for initialisation errors. "
|
||||
"Use POST /api/config/jails/{name}/rollback if a "
|
||||
"specific jail is suspect."
|
||||
),
|
||||
raise OperationError(
|
||||
"fail2ban was stopped but did not come back "
|
||||
"online within 10 seconds. "
|
||||
"Check the fail2ban log for initialisation errors. "
|
||||
"Use POST /api/config/jails/{name}/rollback if a "
|
||||
"specific jail is suspect."
|
||||
)
|
||||
log.info("fail2ban_restarted")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user