]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/orchestrator: Remove 'CONTAINER ID' col from orch ps if unknown 38346/head
authorVarsha Rao <varao@redhat.com>
Mon, 30 Nov 2020 12:19:50 +0000 (17:49 +0530)
committerVarsha Rao <varao@redhat.com>
Mon, 30 Nov 2020 12:21:28 +0000 (17:51 +0530)
Signed-off-by: Varsha Rao <varao@redhat.com>
src/pybind/mgr/orchestrator/module.py

index c3f31ba663c63dc422ec9d8da2f1a47fc4f92b27..9345a907a66e60a5fd9dedc7d2abf78f53ea1c48 100644 (file)
@@ -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('<unknown>') == 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(