From 7c690f04e25e5db28462391df64745ff642e654d Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 29 Jun 2016 10:50:36 -0400 Subject: [PATCH] task get_path returns empty string when not in play --- lib/ansible/playbook/task.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index 36a511312d..d47955749d 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -99,8 +99,10 @@ class Task(Base, Conditional, Taggable, Become): def get_path(self): ''' return the absolute path of the task with its line number ''' - if hasattr(self, '_ds'): - return "%s:%s" % (self._ds._data_source, self._ds._line_number) + path = "" + if hasattr(self, '_ds') and hasattr(self._ds, '_data_source') and hasattr(self._ds, '_line_number'): + path = "%s:%s" % (self._ds._data_source, self._ds._line_number) + return path def get_name(self): ''' return the name of the task '''