summaryrefslogtreecommitdiffstats
path: root/ansible_collections/community/general/plugins/callback/selective.py
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/community/general/plugins/callback/selective.py')
-rw-r--r--ansible_collections/community/general/plugins/callback/selective.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/ansible_collections/community/general/plugins/callback/selective.py b/ansible_collections/community/general/plugins/callback/selective.py
index 526975bd2..069675783 100644
--- a/ansible_collections/community/general/plugins/callback/selective.py
+++ b/ansible_collections/community/general/plugins/callback/selective.py
@@ -44,26 +44,17 @@ from ansible import constants as C
from ansible.plugins.callback import CallbackBase
from ansible.module_utils.common.text.converters import to_text
-try:
- codeCodes = C.COLOR_CODES
-except AttributeError:
- # This constant was moved to ansible.constants in
- # https://github.com/ansible/ansible/commit/1202dd000f10b0e8959019484f1c3b3f9628fc67
- # (will be included in ansible-core 2.11.0). For older Ansible/ansible-base versions,
- # we include from the original location.
- from ansible.utils.color import codeCodes
-
DONT_COLORIZE = False
COLORS = {
'normal': '\033[0m',
- 'ok': '\033[{0}m'.format(codeCodes[C.COLOR_OK]),
+ 'ok': '\033[{0}m'.format(C.COLOR_CODES[C.COLOR_OK]),
'bold': '\033[1m',
'not_so_bold': '\033[1m\033[34m',
- 'changed': '\033[{0}m'.format(codeCodes[C.COLOR_CHANGED]),
- 'failed': '\033[{0}m'.format(codeCodes[C.COLOR_ERROR]),
+ 'changed': '\033[{0}m'.format(C.COLOR_CODES[C.COLOR_CHANGED]),
+ 'failed': '\033[{0}m'.format(C.COLOR_CODES[C.COLOR_ERROR]),
'endc': '\033[0m',
- 'skipped': '\033[{0}m'.format(codeCodes[C.COLOR_SKIP]),
+ 'skipped': '\033[{0}m'.format(C.COLOR_CODES[C.COLOR_SKIP]),
}
@@ -115,8 +106,8 @@ class CallbackModule(CallbackBase):
line_length = 120
if self.last_skipped:
print()
- msg = colorize("# {0} {1}".format(task_name,
- '*' * (line_length - len(task_name))), 'bold')
+ line = "# {0} ".format(task_name)
+ msg = colorize("{0}{1}".format(line, '*' * (line_length - len(line))), 'bold')
print(msg)
def _indent_text(self, text, indent_level):