mgr/orchestrator_cli: sort by service name

This is more consistent when applied across hosts.

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2019-11-11 12:33:03 -06:00
parent 1a3b9fab50
commit 84b009ec3b

View File

@ -260,17 +260,13 @@ class OrchestratorCli(orchestrator.OrchestratorClientMixin, MgrModule):
return HandleCommandResult(stdout=json.dumps(data))
else:
table = PrettyTable(
['TYPE', 'ID', 'HOST', 'CONTAINER', 'VERSION', 'STATUS',
['NAME', 'HOST', 'CONTAINER', 'VERSION', 'STATUS',
'DESCRIPTION'],
border=False)
table.align = 'l'
table.left_padding_width = 0
table.right_padding_width = 1
for s in sorted(services, key=lambda s: s.name()):
if s.service is None:
service_id = s.service_instance
else:
service_id = "{0}.{1}".format(s.service, s.service_instance)
status = {
-1: 'error',
0: 'stopped',
@ -279,8 +275,7 @@ class OrchestratorCli(orchestrator.OrchestratorClientMixin, MgrModule):
}[s.status]
table.add_row((
s.service_type,
service_id,
s.name(),
ukn(s.nodename),
ukn(s.container_id),
ukn(s.version),