Merge pull request #5555 from sivel/expose-playbook-to-callback

Expose the playbook to callback plugins
pull/6359/merge
Michael DeHaan 11 years ago
commit 0a574af270

@ -115,6 +115,12 @@ def log_unflock(runner):
except OSError: except OSError:
pass 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): def set_play(callback, play):
''' used to notify callback plugins of context ''' ''' used to notify callback plugins of context '''
callback.play = play callback.play = play

@ -175,6 +175,7 @@ class PlayBook(object):
self.filename = playbook self.filename = playbook
(self.playbook, self.play_basedirs) = self._load_playbook_from_file(playbook, vars) (self.playbook, self.play_basedirs) = self._load_playbook_from_file(playbook, vars)
ansible.callbacks.load_callback_plugins() ansible.callbacks.load_callback_plugins()
ansible.callbacks.set_playbook(self.callbacks, self)
# ***************************************************** # *****************************************************

Loading…
Cancel
Save