From: Sage Weil Date: Wed, 4 Mar 2020 16:46:52 +0000 (-0600) Subject: mgr/orch: include AGE column in 'orch ps' X-Git-Tag: v15.1.1~103^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=20c4a9783de779e055b3140bfb75b8c7024144dc;p=ceph.git mgr/orch: include AGE column in 'orch ps' Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index ac6e1aca4a6a..74373d94c51b 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -393,7 +393,7 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule): else: now = datetime.datetime.utcnow() table = PrettyTable( - ['NAME', 'HOST', 'STATUS', 'REFRESHED', + ['NAME', 'HOST', 'STATUS', 'REFRESHED', 'AGE', 'VERSION', 'IMAGE NAME', 'IMAGE ID', 'CONTAINER ID'], border=False) table.align = 'l' @@ -407,15 +407,17 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule): None: '' }[s.status] - if s.last_refresh: - age = to_pretty_timedelta(now - s.last_refresh) + ' ago' - else: - age = '-' + def nice_delta(t, suffix=''): + if t: + return to_pretty_timedelta(now - t) + suffix + else: + return '-' table.add_row(( s.name(), ukn(s.hostname), status, - age, + nice_delta(s.last_refresh, ' ago'), + nice_delta(s.created), ukn(s.version), ukn(s.container_image_name), ukn(s.container_image_id)[0:12],