Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get v2_playbook_on_start working #13405

Merged
merged 1 commit into from
Dec 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/ansible/executor/playbook_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ def run(self):
if self._tqm is None: # we are doing a listing
entry = {'playbook': playbook_path}
entry['plays'] = []
else:
# make sure the tqm has callbacks loaded
self._tqm.load_callbacks()
self._tqm.send_callback('v2_playbook_on_start', pb)

i = 1
plays = pb.get_plays()
Expand Down Expand Up @@ -130,8 +134,6 @@ def run(self):
entry['plays'].append(new_play)

else:
# make sure the tqm has callbacks loaded
self._tqm.load_callbacks()
self._tqm._unreachable_hosts.update(self._unreachable_hosts)

# we are actually running plays
Expand Down
3 changes: 3 additions & 0 deletions lib/ansible/playbook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(self, loader):
self._entries = []
self._basedir = os.getcwd()
self._loader = loader
self._file_name = None

@staticmethod
def load(file_name, variable_manager=None, loader=None):
Expand All @@ -61,6 +62,8 @@ def _load_playbook_data(self, file_name, variable_manager):
# set the loaders basedir
self._loader.set_basedir(self._basedir)

self._file_name = file_name

# dynamically load any plugins from the playbook directory
for name, obj in get_all_plugin_loaders():
if obj.subdir:
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/plugins/callback/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def v2_runner_on_async_failed(self, result):
def v2_runner_on_file_diff(self, result, diff):
pass #no v1 correspondance

def v2_playbook_on_start(self):
def v2_playbook_on_start(self, playbook):
self.playbook_on_start()

def v2_playbook_on_notify(self, result, handler):
Expand Down