mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-22 16:20:22 -07:00
V2 fixing bugs
This commit is contained in:
parent
79cf7e7292
commit
785c0c0c8c
34 changed files with 505 additions and 426 deletions
|
@ -73,3 +73,20 @@ def stringc(text, color):
|
|||
|
||||
# --- end "pretty"
|
||||
|
||||
def colorize(lead, num, color):
|
||||
""" Print 'lead' = 'num' in 'color' """
|
||||
if num != 0 and ANSIBLE_COLOR and color is not None:
|
||||
return "%s%s%-15s" % (stringc(lead, color), stringc("=", color), stringc(str(num), color))
|
||||
else:
|
||||
return "%s=%-4s" % (lead, str(num))
|
||||
|
||||
def hostcolor(host, stats, color=True):
|
||||
if ANSIBLE_COLOR and color:
|
||||
if stats['failures'] != 0 or stats['unreachable'] != 0:
|
||||
return "%-37s" % stringc(host, 'red')
|
||||
elif stats['changed'] != 0:
|
||||
return "%-37s" % stringc(host, 'yellow')
|
||||
else:
|
||||
return "%-37s" % stringc(host, 'green')
|
||||
return "%-26s" % host
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue