From: Sage Weil Date: Mon, 25 Nov 2019 14:44:54 +0000 (-0600) Subject: mgr/orchestrator_cli: print table for 'host ls' X-Git-Tag: v15.1.0~742^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f06366836ffabe9ff4fb1cb2b74298a3971ded58;p=ceph.git mgr/orchestrator_cli: print table for 'host ls' Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/orchestrator_cli/module.py b/src/pybind/mgr/orchestrator_cli/module.py index 3da51bd123c6..3d3bba539567 100644 --- a/src/pybind/mgr/orchestrator_cli/module.py +++ b/src/pybind/mgr/orchestrator_cli/module.py @@ -171,8 +171,15 @@ class OrchestratorCli(orchestrator.OrchestratorClientMixin, MgrModule): completion = self.get_hosts() self._orchestrator_wait([completion]) orchestrator.raise_if_exception(completion) - result = "\n".join(map(lambda node: node.name, completion.result)) - return HandleCommandResult(stdout=result) + table = PrettyTable( + ['HOST', 'LABELS'], + border=False) + table.align = 'l' + table.left_padding_width = 0 + table.right_padding_width = 1 + for node in completion.result: + table.add_row((node.name, ' '.join(node.labels))) + return HandleCommandResult(stdout=table.get_string()) @orchestrator._cli_write_command( 'orchestrator host label add',