Move diff code more into runner code.

This commit is contained in:
Michael DeHaan 2013-02-09 23:24:03 -05:00
parent 6f0c9592bb
commit 72a05ae2a0
4 changed files with 31 additions and 18 deletions

View file

@ -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)
########################################################################