Skip to content

Commit

Permalink
Improve callback output to align header with roles, tasks and play RECAP
Browse files Browse the repository at this point in the history
  • Loading branch information
ansiblejunky authored and saito-hideki committed Oct 2, 2024
1 parent 0821768 commit afa724b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/387_callback_output_header.yml
Original file line number Diff line number Diff line change
@@ -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).
5 changes: 4 additions & 1 deletion plugins/callback/profile_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion plugins/callback/profile_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion plugins/callback/timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

0 comments on commit afa724b

Please sign in to comment.