mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-13 19:59:10 -07:00
Move diff code more into runner code.
This commit is contained in:
parent
6f0c9592bb
commit
72a05ae2a0
4 changed files with 31 additions and 18 deletions
|
@ -219,7 +219,8 @@ class DefaultRunnerCallbacks(object):
|
|||
call_callback_module('runner_on_async_failed', host, res, jid)
|
||||
|
||||
def on_file_diff(self, host, before_string, after_string):
|
||||
call_callback_module('runner_on_file_diff', before_string, after_string)
|
||||
if before_string and after_string:
|
||||
call_callback_module('runner_on_file_diff', before_string, after_string)
|
||||
|
||||
########################################################################
|
||||
|
||||
|
@ -286,9 +287,10 @@ class CliRunnerCallbacks(DefaultRunnerCallbacks):
|
|||
utils.write_tree_file(self.options.tree, host, utils.jsonify(result2,format=True))
|
||||
|
||||
def on_file_diff(self, host, before_string, after_string):
|
||||
if self.options.diff:
|
||||
print utils.get_diff(before_string, after_string)
|
||||
super(CliRunnerCallbacks, self).on_file_diff(host, before_string, after_string)
|
||||
if before_string and after_string:
|
||||
if self.options.diff:
|
||||
print utils.get_diff(before_string, after_string)
|
||||
super(CliRunnerCallbacks, self).on_file_diff(host, before_string, after_string)
|
||||
|
||||
########################################################################
|
||||
|
||||
|
@ -422,8 +424,9 @@ class PlaybookRunnerCallbacks(DefaultRunnerCallbacks):
|
|||
super(PlaybookRunnerCallbacks, self).on_async_failed(host,res,jid)
|
||||
|
||||
def on_file_diff(self, host, before_string, after_string):
|
||||
print utils.get_diff(before_string, after_string)
|
||||
super(PlaybookRunnerCallbacks, self).on_file_diff(host, before_string, after_string)
|
||||
if before_string and after_string:
|
||||
print utils.get_diff(before_string, after_string)
|
||||
super(PlaybookRunnerCallbacks, self).on_file_diff(host, before_string, after_string)
|
||||
|
||||
########################################################################
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue