Skip to content

Commit

Permalink
task get_path returns empty string when not in play
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoca committed Jun 29, 2016
1 parent 52d4079 commit 7c690f0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/ansible/playbook/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ def __init__(self, block=None, role=None, task_include=None):
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 '''
Expand Down

0 comments on commit 7c690f0

Please sign in to comment.