mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-06-16 12:57:40 +00:00
[PR #12065/2f83a5b0 backport][stable-12] selective callback plugin: align host names in stats output (#12071)
selective callback plugin: align host names in stats output (#12065)
* fix(selective): align host names in stats output
* changelog(selective): add fragment for PR #12065
---------
(cherry picked from commit 2f83a5b084)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bd8740892a
commit
7304fd6b3c
2 changed files with 5 additions and 2 deletions
|
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- selective callback plugin - align host names in stats output by padding to the longest name (https://github.com/ansible-collections/community.general/issues/8797, https://github.com/ansible-collections/community.general/pull/12065).
|
||||
|
|
@ -228,6 +228,7 @@ class CallbackModule(CallbackBase):
|
|||
self._print_task("STATS")
|
||||
|
||||
hosts = sorted(stats.processed.keys())
|
||||
max_len = max((len(h) for h in hosts), default=0)
|
||||
for host in hosts:
|
||||
s = stats.summarize(host)
|
||||
|
||||
|
|
@ -239,8 +240,8 @@ class CallbackModule(CallbackBase):
|
|||
color = "ok"
|
||||
|
||||
msg = (
|
||||
f"{host} : ok={s['ok']}\tchanged={s['changed']}\tfailed={s['failures']}\tunreachable="
|
||||
f"{s['unreachable']}\trescued={s['rescued']}\tignored={s['ignored']}"
|
||||
f"{host.ljust(max_len)} : ok={s['ok']}\tchanged={s['changed']}\tfailed={s['failures']}\t"
|
||||
f"unreachable={s['unreachable']}\trescued={s['rescued']}\tignored={s['ignored']}"
|
||||
)
|
||||
print(colorize(msg, color))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue