web: Fix Glances connection for local host in container rows endpoint (#161)

This commit is contained in:
Bas Nijholt
2026-01-08 13:04:14 +01:00
committed by GitHub
parent d65f4cf7f4
commit c159549a9e

View File

@@ -244,7 +244,7 @@ async def get_containers_rows_by_host(host_name: str) -> HTMLResponse:
import time # noqa: PLC0415
from compose_farm.executor import get_container_compose_labels # noqa: PLC0415
from compose_farm.glances import fetch_container_stats # noqa: PLC0415
from compose_farm.glances import _get_glances_address, fetch_container_stats # noqa: PLC0415
logger = logging.getLogger(__name__)
config = get_config()
@@ -253,9 +253,10 @@ async def get_containers_rows_by_host(host_name: str) -> HTMLResponse:
return HTMLResponse("")
host = config.hosts[host_name]
glances_address = _get_glances_address(host_name, host, config.glances_stack)
t0 = time.monotonic()
containers, error = await fetch_container_stats(host_name, host.address)
containers, error = await fetch_container_stats(host_name, glances_address)
t1 = time.monotonic()
fetch_ms = (t1 - t0) * 1000