From 594179f1aae5fcca631b24c2f1e2dbf4a3b5c460 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 16 Dec 2019 12:56:24 -0600 Subject: [PATCH] mgr/orchestrator_cli: combine all host into one 'device ls' table Signed-off-by: Sage Weil --- src/pybind/mgr/orchestrator_cli/module.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/pybind/mgr/orchestrator_cli/module.py b/src/pybind/mgr/orchestrator_cli/module.py index 1a003cbcaff..56d264ec136 100644 --- a/src/pybind/mgr/orchestrator_cli/module.py +++ b/src/pybind/mgr/orchestrator_cli/module.py @@ -247,19 +247,19 @@ class OrchestratorCli(orchestrator.OrchestratorClientMixin, MgrModule): else: out = [] + table = PrettyTable( + ['HOST', 'PATH', 'TYPE', 'SIZE', 'DEVICE', 'AVAIL', + 'REJECT REASONS'], + border=False) + table.align = 'l' + table._align['SIZE'] = 'r' + table.left_padding_width = 0 + table.right_padding_width = 1 for host in completion.result: # type: orchestrator.InventoryNode - out.append('Host {}:'.format(host.name)) - table = PrettyTable( - ['PATH', 'TYPE', 'SIZE', 'DEVICE', 'AVAIL', - 'REJECT REASONS'], - border=False) - table.align = 'l' - table._align['SIZE'] = 'r' - table.left_padding_width = 0 - table.right_padding_width = 1 for d in host.devices.devices: # type: Device table.add_row( ( + host.name, d.path, d.human_readable_type, format_bytes(d.sys_api.get('size', 0), 5, colored=False), @@ -268,7 +268,7 @@ class OrchestratorCli(orchestrator.OrchestratorClientMixin, MgrModule): ', '.join(d.rejected_reasons) ) ) - out.append(table.get_string()) + out.append(table.get_string()) return HandleCommandResult(stdout='\n'.join(out)) @orchestrator._cli_read_command( -- 2.39.5