mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-19 14:50:21 -07:00
Merge pull request #8012 from cchurch/callback_cleanup
Callback plugin cleanup
This commit is contained in:
commit
51e014d915
7 changed files with 12 additions and 48 deletions
|
@ -41,9 +41,6 @@ class CallbackModule(object):
|
|||
def runner_on_ok(self, host, res):
|
||||
pass
|
||||
|
||||
def runner_on_error(self, host, msg):
|
||||
pass
|
||||
|
||||
def runner_on_skipped(self, host, item=None):
|
||||
pass
|
||||
|
||||
|
@ -89,7 +86,7 @@ class CallbackModule(object):
|
|||
def playbook_on_not_import_for_host(self, host, missing_file):
|
||||
pass
|
||||
|
||||
def playbook_on_play_start(self, pattern):
|
||||
def playbook_on_play_start(self, name):
|
||||
pass
|
||||
|
||||
def playbook_on_stats(self, stats):
|
||||
|
|
|
@ -343,9 +343,6 @@ class DefaultRunnerCallbacks(object):
|
|||
def on_ok(self, host, res):
|
||||
call_callback_module('runner_on_ok', host, res)
|
||||
|
||||
def on_error(self, host, msg):
|
||||
call_callback_module('runner_on_error', host, msg)
|
||||
|
||||
def on_skipped(self, host, item=None):
|
||||
call_callback_module('runner_on_skipped', host, item=item)
|
||||
|
||||
|
@ -404,10 +401,6 @@ class CliRunnerCallbacks(DefaultRunnerCallbacks):
|
|||
display("%s | skipped" % (host), runner=self.runner)
|
||||
super(CliRunnerCallbacks, self).on_skipped(host, item)
|
||||
|
||||
def on_error(self, host, err):
|
||||
display("err: [%s] => %s\n" % (host, err), stderr=True, runner=self.runner)
|
||||
super(CliRunnerCallbacks, self).on_error(host, err)
|
||||
|
||||
def on_no_hosts(self):
|
||||
display("no hosts matched\n", stderr=True, runner=self.runner)
|
||||
super(CliRunnerCallbacks, self).on_no_hosts()
|
||||
|
@ -534,18 +527,6 @@ class PlaybookRunnerCallbacks(DefaultRunnerCallbacks):
|
|||
display(msg, color='yellow', runner=self.runner)
|
||||
super(PlaybookRunnerCallbacks, self).on_ok(host, host_result)
|
||||
|
||||
def on_error(self, host, err):
|
||||
|
||||
item = err.get('item', None)
|
||||
msg = ''
|
||||
if item:
|
||||
msg = "err: [%s] => (item=%s) => %s" % (host, item, err)
|
||||
else:
|
||||
msg = "err: [%s] => %s" % (host, err)
|
||||
|
||||
display(msg, color='red', stderr=True, runner=self.runner)
|
||||
super(PlaybookRunnerCallbacks, self).on_error(host, err)
|
||||
|
||||
def on_skipped(self, host, item=None):
|
||||
if constants.DISPLAY_SKIPPED_HOSTS:
|
||||
msg = ''
|
||||
|
@ -695,9 +676,9 @@ class PlaybookCallbacks(object):
|
|||
display(msg, color='cyan')
|
||||
call_callback_module('playbook_on_not_import_for_host', host, missing_file)
|
||||
|
||||
def on_play_start(self, pattern):
|
||||
display(banner("PLAY [%s]" % pattern))
|
||||
call_callback_module('playbook_on_play_start', pattern)
|
||||
def on_play_start(self, name):
|
||||
display(banner("PLAY [%s]" % name))
|
||||
call_callback_module('playbook_on_play_start', name)
|
||||
|
||||
def on_stats(self, stats):
|
||||
call_callback_module('playbook_on_stats', stats)
|
||||
|
|
|
@ -322,8 +322,9 @@ class PlayBook(object):
|
|||
ansible.callbacks.set_play(self.runner_callbacks, play)
|
||||
if not self._run_play(play):
|
||||
break
|
||||
ansible.callbacks.set_play(self.callbacks, None)
|
||||
ansible.callbacks.set_play(self.runner_callbacks, None)
|
||||
|
||||
ansible.callbacks.set_play(self.callbacks, None)
|
||||
ansible.callbacks.set_play(self.runner_callbacks, None)
|
||||
|
||||
# summarize the results
|
||||
results = {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue