diff --git a/changelogs/fragments/7374-fix-selective-callback-taskname-length.yml b/changelogs/fragments/7374-fix-selective-callback-taskname-length.yml new file mode 100644 index 0000000000..1c48f48e05 --- /dev/null +++ b/changelogs/fragments/7374-fix-selective-callback-taskname-length.yml @@ -0,0 +1,2 @@ +bugfixes: + - "selective callback plugin - fix length of task name lines in output always being 3 characters longer than desired (https://github.com/ansible-collections/community.general/pull/7374)." diff --git a/plugins/callback/selective.py b/plugins/callback/selective.py index 526975bd2c..610bb4784e 100644 --- a/plugins/callback/selective.py +++ b/plugins/callback/selective.py @@ -115,8 +115,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):