From 684b9f629e5f9c8979d5d2ecfc2384919e0482d7 Mon Sep 17 00:00:00 2001 From: Maxim Devaev Date: Wed, 23 Oct 2024 23:02:25 +0300 Subject: send kvmd version to ws --- kvmd/apps/kvmd/server.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'kvmd') diff --git a/kvmd/apps/kvmd/server.py b/kvmd/apps/kvmd/server.py index b88bc6b7..cd50678f 100644 --- a/kvmd/apps/kvmd/server.py +++ b/kvmd/apps/kvmd/server.py @@ -33,6 +33,8 @@ from aiohttp.web import Request from aiohttp.web import Response from aiohttp.web import WebSocketResponse +from ... import __version__ + from ...logging import get_logger from ...errors import OperationError @@ -251,7 +253,13 @@ class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-ins stream = valid_bool(req.query.get("stream", True)) legacy = valid_bool(req.query.get("legacy", True)) async with self._ws_session(req, stream=stream, legacy=legacy) as ws: - await ws.send_event("loop", {}) + (major, minor) = __version__.split(".") + await ws.send_event("loop", { + "version": { + "major": int(major), + "minor": int(minor), + }, + }) states = [ (event_type, src.get_state()) for sub in self.__subsystems -- cgit v1.2.3