From b2a6784a9fc1a8e1165d4f3b2b5d23b67d711c5f Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 3 Mar 2016 18:03:02 -0500 Subject: [PATCH] changed the output to keep backwards compat still shows path when verbose --- lib/ansible/plugins/callback/profile_tasks.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/ansible/plugins/callback/profile_tasks.py b/lib/ansible/plugins/callback/profile_tasks.py index 644c5653a56..19bdd5bf4c2 100644 --- a/lib/ansible/plugins/callback/profile_tasks.py +++ b/lib/ansible/plugins/callback/profile_tasks.py @@ -99,7 +99,9 @@ class CallbackModule(CallbackBase): # Record the start time of the current task self.current = task._uuid - self.stats[self.current] = {'time': time.time(), 'name': task.get_name(), 'path': task.get_path()} + self.stats[self.current] = {'time': time.time(), 'name': task.get_name()} + if self._display.verbosity >= 2: + self.stats[self.current][ 'path'] = task.get_path() def v2_playbook_on_task_start(self, task, is_conditional): self._record_task(task) @@ -131,10 +133,8 @@ class CallbackModule(CallbackBase): # Print the timings for uuid, result in results: - self._display.display( - "{0:-<70}{1:-<70}{2:->9}".format( - '{0} '.format(result['path']), - '{0} '.format(result['name']), - ' {0:.02f}s'.format(result['time']), - ) - ) + msg = '' + msg="{0:-<70}{1:->9}".format('{0} '.format(result['name']),' {0:.02f}s'.format(result['time'])) + if 'path' in result: + msg += "\n{0:-<79}".format( '{0} '.format(result['path'])) + self._display.display(msg)