Skip to content

Commit

Permalink
Merge pull request ansible#5555 from sivel/expose-playbook-to-callback
Browse files Browse the repository at this point in the history
Expose the playbook to callback plugins
  • Loading branch information
mpdehaan committed Apr 3, 2014
2 parents 1fa19e2 + f99500d commit 0a574af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ansible/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ def log_unflock(runner):
except OSError:
pass

def set_playbook(callback, playbook):
''' used to notify callback plugins of playbook context '''
callback.playbook = playbook
for callback_plugin in callback_plugins:
callback_plugin.playbook = playbook

def set_play(callback, play):
''' used to notify callback plugins of context '''
callback.play = play
Expand Down
1 change: 1 addition & 0 deletions lib/ansible/playbook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def __init__(self,
self.filename = playbook
(self.playbook, self.play_basedirs) = self._load_playbook_from_file(playbook, vars)
ansible.callbacks.load_callback_plugins()
ansible.callbacks.set_playbook(self.callbacks, self)

# *****************************************************

Expand Down

0 comments on commit 0a574af

Please sign in to comment.