Default tasks without file references to the main playbook file

Some implicit tasks (is the setup task from "gather_facts: yes" the
only one?) do not currently have a file reference as documented in
an issue upstream [1].

Work around the issue in the meantime and default to the main playbook
file if there is no references so that we don't have to handle this
edge case.

[1]: https://github.com/ansible/ansible/issues/28451

Change-Id: I72526ee47bbe86022c60bc5fd23ca9627f86a4de
(cherry picked from commit 24439f60e5)
This commit is contained in:
David Moreau-Simard 2017-08-20 00:01:38 -04:00 committed by David Moreau Simard
parent 93bbb49972
commit dc3acf627d
1 changed files with 3 additions and 3 deletions

View File

@ -282,9 +282,9 @@ class CallbackModule(CallbackBase):
lineno = int(lineno)
file_ = self.get_or_create_file(path)
else:
path = None
lineno = None
file_ = None
path = self.playbook.path
lineno = 1
file_ = self.get_or_create_file(self.playbook.path)
self.task = models.Task(
name=task.get_name(),