summaryrefslogtreecommitdiff
path: root/kvmd/apps
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/apps')
-rw-r--r--kvmd/apps/kvmd/api/info.py10
-rw-r--r--kvmd/apps/kvmd/info/__init__.py6
-rw-r--r--kvmd/apps/kvmd/server.py2
3 files changed, 8 insertions, 10 deletions
diff --git a/kvmd/apps/kvmd/api/info.py b/kvmd/apps/kvmd/api/info.py
index b33a4b6c..5adf3974 100644
--- a/kvmd/apps/kvmd/api/info.py
+++ b/kvmd/apps/kvmd/api/info.py
@@ -27,8 +27,7 @@ from typing import List
from aiohttp.web import Request
from aiohttp.web import Response
-from ....validators import check_string_in_list
-from ....validators.basic import valid_string_list
+from ....validators.kvm import valid_info_fields
from ..info import InfoManager
@@ -54,8 +53,7 @@ class InfoApi:
def __valid_info_fields(self, request: Request) -> List[str]:
subs = self.__info_manager.get_subs()
- return (sorted(set(valid_string_list(
+ return sorted(valid_info_fields(
arg=request.query.get("fields", ",".join(subs)),
- subval=(lambda field: check_string_in_list(field, "info field", subs)),
- name="info fields list",
- ))) or subs)
+ variants=subs,
+ ) or subs)
diff --git a/kvmd/apps/kvmd/info/__init__.py b/kvmd/apps/kvmd/info/__init__.py
index 3e833aed..dcb192d9 100644
--- a/kvmd/apps/kvmd/info/__init__.py
+++ b/kvmd/apps/kvmd/info/__init__.py
@@ -20,7 +20,7 @@
# ========================================================================== #
-from typing import List
+from typing import Set
from ....yamlconf import Section
@@ -41,8 +41,8 @@ class InfoManager:
"hw": HwInfoSubmanager(**config.kvmd.info.hw._unpack()),
}
- def get_subs(self) -> List[str]:
- return list(self.__subs)
+ def get_subs(self) -> Set[str]:
+ return set(self.__subs)
def get_submanager(self, name: str) -> BaseInfoSubmanager:
return self.__subs[name]
diff --git a/kvmd/apps/kvmd/server.py b/kvmd/apps/kvmd/server.py
index cb999fb9..f50c3688 100644
--- a/kvmd/apps/kvmd/server.py
+++ b/kvmd/apps/kvmd/server.py
@@ -170,7 +170,7 @@ class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-ins
],
*[
_Component(f"Info manager ({sub})", f"info_{sub}_state", info_manager.get_submanager(sub))
- for sub in info_manager.get_subs()
+ for sub in sorted(info_manager.get_subs())
],
*[
_Component("Wake-on-LAN", "wol_state", wol),