mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-25 01:16:18 -05:00
controller: report and stop every installed VNC backend
Greptile P1 (security): with both stacks installed, selection keyed only off wayvnc's unit and config. If RealVNC was the one running, status reported VNC as off and stop targeted wayvnc — leaving the screen remotely accessible while the UI claimed VNC was off. Reproduced on 10.0.0.8: RealVNC serving on 5900 reported as running=false. Now every installed backend is reported with its own active state: status is on when any backend runs and names the one actually serving, and stop stops all running backends. wayvnc is still preferred for starting. Greptile P2 (latency): both units are probed in a single multi-unit `systemctl show`, and the status dict no longer re-probes, so VNC adds one subprocess to /api/stats rather than three. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
2328524ab2
commit
5313ab57ef
3 changed files with 310 additions and 130 deletions
|
|
@ -203,8 +203,8 @@ class TestVncEndpoints:
|
|||
from unittest import mock
|
||||
from controller.lib.admin import DesktopStatus
|
||||
|
||||
with mock.patch("controller.lib.admin.get_vnc_backend",
|
||||
return_value=("wayvnc.service", "wayvnc", None)):
|
||||
with mock.patch("controller.lib.admin.get_vnc_backends",
|
||||
return_value=([{"unit": "wayvnc.service", "name": "wayvnc", "active": False}], None)):
|
||||
with mock.patch("controller.lib.admin.get_desktop_status", return_value=DesktopStatus.off):
|
||||
response = test_client.post("/api/vnc/start")
|
||||
|
||||
|
|
@ -220,8 +220,8 @@ class TestVncEndpoints:
|
|||
mock_proc.communicate.return_value = (b"", b"")
|
||||
mock_proc.returncode = 0
|
||||
|
||||
with mock.patch("controller.lib.admin.get_vnc_backend",
|
||||
return_value=("wayvnc.service", "wayvnc", None)):
|
||||
with mock.patch("controller.lib.admin.get_vnc_backends",
|
||||
return_value=([{"unit": "wayvnc.service", "name": "wayvnc", "active": False}], None)):
|
||||
with mock.patch("controller.lib.admin.get_desktop_status", return_value=DesktopStatus.on):
|
||||
with mock.patch("asyncio.create_subprocess_exec", return_value=mock_proc) as mock_exec:
|
||||
response = test_client.post("/api/vnc/start")
|
||||
|
|
@ -240,8 +240,8 @@ class TestVncEndpoints:
|
|||
mock_proc.communicate.return_value = (b"", b"")
|
||||
mock_proc.returncode = 0
|
||||
|
||||
with mock.patch("controller.lib.admin.get_vnc_backend",
|
||||
return_value=("wayvnc.service", "wayvnc", None)):
|
||||
with mock.patch("controller.lib.admin.get_vnc_backends",
|
||||
return_value=([{"unit": "wayvnc.service", "name": "wayvnc", "active": True}], None)):
|
||||
with mock.patch("controller.lib.admin.get_desktop_status", return_value=DesktopStatus.off):
|
||||
with mock.patch("asyncio.create_subprocess_exec", return_value=mock_proc) as mock_exec:
|
||||
response = test_client.post("/api/vnc/stop")
|
||||
|
|
@ -259,8 +259,8 @@ class TestVncEndpoints:
|
|||
mock_proc.communicate.return_value = (b"", b"Job for wayvnc.service failed")
|
||||
mock_proc.returncode = 1
|
||||
|
||||
with mock.patch("controller.lib.admin.get_vnc_backend",
|
||||
return_value=("wayvnc.service", "wayvnc", None)):
|
||||
with mock.patch("controller.lib.admin.get_vnc_backends",
|
||||
return_value=([{"unit": "wayvnc.service", "name": "wayvnc", "active": False}], None)):
|
||||
with mock.patch("controller.lib.admin.get_desktop_status", return_value=DesktopStatus.on):
|
||||
with mock.patch("asyncio.create_subprocess_exec", return_value=mock_proc):
|
||||
response = test_client.post("/api/vnc/start")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue