mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 15:11:23 -07:00
task get_path returns empty string when not in play
This commit is contained in:
parent
52d4079184
commit
7c690f04e2
1 changed files with 4 additions and 2 deletions
|
@ -99,8 +99,10 @@ class Task(Base, Conditional, Taggable, Become):
|
||||||
def get_path(self):
|
def get_path(self):
|
||||||
''' return the absolute path of the task with its line number '''
|
''' return the absolute path of the task with its line number '''
|
||||||
|
|
||||||
if hasattr(self, '_ds'):
|
path = ""
|
||||||
return "%s:%s" % (self._ds._data_source, self._ds._line_number)
|
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):
|
def get_name(self):
|
||||||
''' return the name of the task '''
|
''' return the name of the task '''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue