From 72e9345faa725bd2aaba41e06ed34927badd7622 Mon Sep 17 00:00:00 2001 From: Redouane Kachach Date: Wed, 13 Sep 2023 13:46:42 +0200 Subject: [PATCH] Adding service_name and daemon_type and fixing mypy issues Signed-off-by: Redouane Kachach --- src/pybind/mgr/orchestrator/module.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index a9eec89423be..bfe422a944f5 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -130,6 +130,8 @@ yaml.add_representer(HostDetails, HostDetails.yaml_representer) class DaemonFields(enum.Enum): + service_name = 'service_name' + daemon_type = 'daemon_type' name = 'name' host = 'host' status = 'status' @@ -139,6 +141,7 @@ class DaemonFields(enum.Enum): mem_lim = 'mem_lim' image = 'image' + class ServiceType(enum.Enum): mon = 'mon' mgr = 'mgr' @@ -835,13 +838,13 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule, def ukn(s: Optional[str]) -> str: return '' if s is None else s - def sort_by_field(d: DaemonDescription) -> Optional[str]: + def sort_by_field(d: DaemonDescription) -> Any: if sort_by == DaemonFields.name: return d.name() elif sort_by == DaemonFields.host: return d.hostname elif sort_by == DaemonFields.status: - return d.status + return d.status.name if d.status else None elif sort_by == DaemonFields.refreshed: return d.last_refresh elif sort_by == DaemonFields.age: @@ -852,6 +855,10 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule, return d.memory_request elif sort_by == DaemonFields.image: return d.container_image_id + elif sort_by == DaemonFields.daemon_type: + return d.daemon_type + elif sort_by == DaemonFields.service_name: + return d.service_name() else: return None -- 2.47.3