From ba2d1d0bc4e75c01d04a4b57aa90f5c33aeaba67 Mon Sep 17 00:00:00 2001 From: Alexandre Garnier Date: Sun, 24 Jul 2016 00:09:20 +0200 Subject: [PATCH] Colorize around text (#16415) Avoid to colorize separately `lead`, equals sign and `num` and separate them by coloring characters. --- lib/ansible/utils/color.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/utils/color.py b/lib/ansible/utils/color.py index 81a05d749e1..35b60f489ba 100644 --- a/lib/ansible/utils/color.py +++ b/lib/ansible/utils/color.py @@ -78,10 +78,10 @@ def stringc(text, color): def colorize(lead, num, color): """ Print 'lead' = 'num' in 'color' """ + s = u"%s=%-4s" % (lead, str(num)) if num != 0 and ANSIBLE_COLOR and color is not None: - return u"%s%s%-15s" % (stringc(lead, color), stringc("=", color), stringc(str(num), color)) - else: - return u"%s=%-4s" % (lead, str(num)) + s = stringc(s, color) + return s def hostcolor(host, stats, color=True): if ANSIBLE_COLOR and color: