From bdc95f975e2c0644638ce2384a15922b8af5534b Mon Sep 17 00:00:00 2001 From: t0kubetsu Date: Tue, 9 Jun 2026 10:39:15 +0200 Subject: [PATCH] fix(ci): resolve ruff errors blocking CI - Add missing `from typing import Any` import (E0602 / F821) - Rename ambiguous loop variable `l` to `line` (E741) - Remove unused `pytest` and `Path` imports from test_ws_helpers (F401) --- app/routes/vms.py | 3 ++- tests/test_ws_helpers.py | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) 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