1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

task get_path returns empty string when not in play

This commit is contained in:
Brian Coca 2016-06-29 10:50:36 -04:00
parent 52d4079184
commit 7c690f04e2

View file

@ -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 '''