From: Sage Weil Date: Mon, 16 Dec 2019 18:56:24 +0000 (-0600) Subject: mgr/orchestrator_cli: combine all host into one 'device ls' table X-Git-Tag: v15.1.0~455^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=594179f1aae5fcca631b24c2f1e2dbf4a3b5c460;p=ceph-ci.git mgr/orchestrator_cli: combine all host into one 'device ls' table Signed-off-by: Sage Weil --- 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(