From: Varsha Rao Date: Mon, 30 Nov 2020 12:19:50 +0000 (+0530) Subject: mgr/orchestrator: Remove 'CONTAINER ID' col from orch ps if unknown X-Git-Tag: v16.1.0~352^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F38346%2Fhead;p=ceph.git mgr/orchestrator: Remove 'CONTAINER ID' col from orch ps if unknown Signed-off-by: Varsha Rao --- diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index c3f31ba663c6..9345a907a66e 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -601,6 +601,18 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule, ukn(s.container_image_id)[0:12], ukn(s.container_id))) + remove_column = 'CONTAINER ID' + if table.get_string(fields=[remove_column], border=False, + header=False).count('') == len(daemons): + try: + table.del_column(remove_column) + except AttributeError as e: + # del_column method was introduced in prettytable 2.0 + if str(e) != "del_column": + raise + table.field_names.remove(remove_column) + table._rows = [row[:-1] for row in table._rows] + return HandleCommandResult(stdout=table.get_string()) @_cli_write_command(