Merge pull request #13405 from sivel/v2-playbook-on-start

Get v2_playbook_on_start working
This commit is contained in:
James Cammarata 2015-12-02 12:40:24 -05:00
commit 5f1f2acfea
3 changed files with 8 additions and 3 deletions

View file

@ -82,6 +82,10 @@ class PlaybookExecutor:
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()
@ -130,8 +134,6 @@ class PlaybookExecutor:
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

View file

@ -44,6 +44,7 @@ class Playbook:
self._entries = []
self._basedir = os.getcwd()
self._loader = loader
self._file_name = None
@staticmethod
def load(file_name, variable_manager=None, loader=None):
@ -61,6 +62,8 @@ class Playbook:
# 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:

View file

@ -246,7 +246,7 @@ class CallbackBase:
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):