Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/routes/vms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions tests/test_ws_helpers.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading