From 1a3b9fab509e4fb5404cae29a973534cc7362d60 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 11 Nov 2019 12:32:42 -0600 Subject: [PATCH] mgr/orchestrator_cli: collapse TYPE and ID columns Signed-off-by: Sage Weil --- src/pybind/mgr/orchestrator.py | 5 +++++ src/pybind/mgr/orchestrator_cli/module.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/orchestrator.py b/src/pybind/mgr/orchestrator.py index dc9e57f2fe9ed..ea96f7296b6ae 100644 --- a/src/pybind/mgr/orchestrator.py +++ b/src/pybind/mgr/orchestrator.py @@ -671,6 +671,11 @@ class ServiceDescription(object): # Service status description when status == -1. self.status_desc = status_desc + def name(self): + if self.service_instance: + return '%s.%s' % (self.service_type, self.service_instance) + return self.service_type + def to_json(self): out = { 'nodename': self.nodename, diff --git a/src/pybind/mgr/orchestrator_cli/module.py b/src/pybind/mgr/orchestrator_cli/module.py index 6f9f3c30008b7..7cd699b258d25 100644 --- a/src/pybind/mgr/orchestrator_cli/module.py +++ b/src/pybind/mgr/orchestrator_cli/module.py @@ -266,7 +266,7 @@ class OrchestratorCli(orchestrator.OrchestratorClientMixin, MgrModule): table.align = 'l' table.left_padding_width = 0 table.right_padding_width = 1 - for s in services: + for s in sorted(services, key=lambda s: s.name()): if s.service is None: service_id = s.service_instance else: -- 2.39.5