From afa724ba8a1453cc78d64c43bd3b64e113a37f58 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 20 Sep 2022 14:38:08 -0700 Subject: [PATCH] Improve callback output to align header with roles, tasks and play RECAP --- changelogs/fragments/387_callback_output_header.yml | 3 +++ plugins/callback/profile_roles.py | 5 ++++- plugins/callback/profile_tasks.py | 5 ++++- plugins/callback/timer.py | 4 +++- 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/387_callback_output_header.yml diff --git a/changelogs/fragments/387_callback_output_header.yml b/changelogs/fragments/387_callback_output_header.yml new file mode 100644 index 0000000000..5eb8573b8f --- /dev/null +++ b/changelogs/fragments/387_callback_output_header.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - callback plugins - Add recap information to timer, profile_roles and profile_tasks callback outputs (https://github.com/ansible-collections/ansible.posix/pull/387). diff --git a/plugins/callback/profile_roles.py b/plugins/callback/profile_roles.py index 59a437f9b4..270a74f3f5 100644 --- a/plugins/callback/profile_roles.py +++ b/plugins/callback/profile_roles.py @@ -128,7 +128,10 @@ def playbook_on_setup(self): self._display_tasktime() def playbook_on_stats(self, stats): - self._display_tasktime() + # Align summary report header with other callback plugin summary + self._display.banner("ROLES RECAP") + + self._display.display(tasktime()) self._display.display(filled("", fchar="=")) timestamp(self) diff --git a/plugins/callback/profile_tasks.py b/plugins/callback/profile_tasks.py index 5fb7972ce5..c5cc5fe873 100644 --- a/plugins/callback/profile_tasks.py +++ b/plugins/callback/profile_tasks.py @@ -193,7 +193,10 @@ def playbook_on_setup(self): self._display_tasktime() def playbook_on_stats(self, stats): - self._display_tasktime() + # Align summary report header with other callback plugin summary + self._display.banner("TASKS RECAP") + + self._display.display(tasktime()) self._display.display(filled("", fchar="=")) timestamp(self) diff --git a/plugins/callback/timer.py b/plugins/callback/timer.py index 3ef9255eb1..e2eca0597a 100644 --- a/plugins/callback/timer.py +++ b/plugins/callback/timer.py @@ -46,4 +46,6 @@ def playbook_on_stats(self, stats): def v2_playbook_on_stats(self, stats): end_time = datetime.utcnow() runtime = end_time - self.start_time - self._display.display("Playbook run took %s days, %s hours, %s minutes, %s seconds" % (self.days_hours_minutes_seconds(runtime))) + # Align summary report header with other callback plugin summary + self._display.banner("PLAYBOOK RECAP") + self._display.display("Playbook run took %s days, %s hours, %s minutes, %s seconds\n\r" % (self.days_hours_minutes_seconds(runtime)))