diff --git a/app/routes/vms.py b/app/routes/vms.py index 4ca13ed..53e9e44 100644 --- a/app/routes/vms.py +++ b/app/routes/vms.py @@ -23,6 +23,7 @@ import logging import os from pathlib import Path +from typing import Any from fastapi import APIRouter, HTTPException from fastapi.responses import JSONResponse @@ -85,7 +86,7 @@ def _run_proxmox_action(req, action: str, extravars: dict) -> JSONResponse: # On failure, include error context from Ansible logs if rc != 0: lines = log_plain.splitlines() - fatal = next((l for l in lines if "fatal:" in l or "FAILED" in l), None) + fatal = next((line for line in lines if "fatal:" in line or "FAILED" in line), None) payload["error"] = fatal.strip() if fatal else f"Ansible exited with rc={rc}" payload["log_multiline"] = lines[-10:] # last 10 lines for context else: diff --git a/tests/test_ws_helpers.py b/tests/test_ws_helpers.py index 2999c2b..065518f 100644 --- a/tests/test_ws_helpers.py +++ b/tests/test_ws_helpers.py @@ -1,8 +1,6 @@ """Tests for WebSocket helper functions in app.routes.ws_status.""" import os -import pytest -from pathlib import Path from unittest.mock import patch from app.routes.ws_status import compute_diff, load_proxmox_credentials