started implementing diff

diff now works with template
also fixed check mode for template and copy
This commit is contained in:
Brian Coca 2015-07-26 12:21:38 -04:00
parent d11e07a0e5
commit 0b6fadaad7
8 changed files with 71 additions and 52 deletions

View file

@ -40,9 +40,9 @@ class CallbackBase:
def __init__(self, display):
self._display = display
if self._display.verbosity >= 4:
name = getattr(self, 'CALLBACK_NAME', 'with no defined name')
ctype = getattr(self, 'CALLBACK_TYPE', 'unknwon')
version = getattr(self, 'CALLBACK_VERSION', 'unknwon')
name = getattr(self, 'CALLBACK_NAME', 'unnamed')
ctype = getattr(self, 'CALLBACK_TYPE', 'old')
version = getattr(self, 'CALLBACK_VERSION', '1.0')
self._display.vvvv('Loaded callback %s of type %s, v%s' % (name, ctype, version))
def _dump_results(self, result, indent=4, sort_keys=True):
@ -117,6 +117,9 @@ class CallbackBase:
def playbook_on_stats(self, stats):
pass
def on_file_diff(self, host, diff):
self._display.display(self._dump_results(diff))
####### V2 METHODS, by default they call v1 counterparts if possible ######
def v2_on_any(self, *args, **kwargs):
self.on_any(args, kwargs)
@ -204,3 +207,7 @@ class CallbackBase:
def v2_playbook_on_stats(self, stats):
self.playbook_on_stats(stats)
def v2_on_file_diff(self, result):
host = result._host.get_name()
if 'diff' in result._result:
self.on_file_diff(host, result._result['diff'])