From 57be05289c71e09b71d3007107976b019ad4367b Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Wed, 9 Oct 2024 15:41:22 +0900 Subject: [PATCH] Revert "Revert "Merge pull request #387 from ansiblejunky/fix-callback-output"" This reverts commit 3a085b0b10e33395630733d4368d408fc781a48d. --- 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 0000000..5eb8573 --- /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 59a437f..270a74f 100644 --- a/plugins/callback/profile_roles.py +++ b/plugins/callback/profile_roles.py @@ -128,7 +128,10 @@ class CallbackModule(CallbackBase): 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 5fb7972..c5cc5fe 100644 --- a/plugins/callback/profile_tasks.py +++ b/plugins/callback/profile_tasks.py @@ -193,7 +193,10 @@ class CallbackModule(CallbackBase): 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 3ef9255..e2eca05 100644 --- a/plugins/callback/timer.py +++ b/plugins/callback/timer.py @@ -46,4 +46,6 @@ class CallbackModule(CallbackBase): 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)))