]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Adding service_name and daemon_type and fixing mypy issues 53867/head
authorRedouane Kachach <rkachach@redhat.com>
Wed, 13 Sep 2023 11:46:42 +0000 (13:46 +0200)
committerAdam King <adking@redhat.com>
Fri, 6 Oct 2023 19:23:52 +0000 (15:23 -0400)
Signed-off-by: Redouane Kachach <rkachach@redhat.com>
(cherry picked from commit 72e9345faa725bd2aaba41e06ed34927badd7622)

src/pybind/mgr/orchestrator/module.py

index db680ab842972ad2e3fa75389b9566d9aed3f8d9..c1fb129d53d7d8077bbf2882de48f6958338449b 100644 (file)
@@ -135,6 +135,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'
@@ -144,6 +146,7 @@ class DaemonFields(enum.Enum):
     mem_lim = 'mem_lim'
     image = 'image'
 
+
 class ServiceType(enum.Enum):
     mon = 'mon'
     mgr = 'mgr'
@@ -841,13 +844,13 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule,
         def ukn(s: Optional[str]) -> str:
             return '<unknown>' 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:
@@ -858,6 +861,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