|
|
@ -106,7 +106,6 @@ class CallbackBase:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
with warnings.catch_warnings():
|
|
|
|
with warnings.catch_warnings():
|
|
|
|
warnings.simplefilter('ignore')
|
|
|
|
warnings.simplefilter('ignore')
|
|
|
|
ret = []
|
|
|
|
|
|
|
|
if 'dst_binary' in diff:
|
|
|
|
if 'dst_binary' in diff:
|
|
|
|
ret.append("diff skipped: destination file appears to be binary\n")
|
|
|
|
ret.append("diff skipped: destination file appears to be binary\n")
|
|
|
|
if 'src_binary' in diff:
|
|
|
|
if 'src_binary' in diff:
|
|
|
@ -128,14 +127,22 @@ class CallbackBase:
|
|
|
|
after_header = "after: %s" % diff['after_header']
|
|
|
|
after_header = "after: %s" % diff['after_header']
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
after_header = 'after'
|
|
|
|
after_header = 'after'
|
|
|
|
differ = difflib.unified_diff(to_unicode(diff['before']).splitlines(True), to_unicode(diff['after']).splitlines(True), before_header, after_header, '', '', 10)
|
|
|
|
differ = difflib.unified_diff(to_unicode(diff['before']).splitlines(True),
|
|
|
|
ret.extend(list(differ))
|
|
|
|
to_unicode(diff['after']).splitlines(True),
|
|
|
|
ret.append('\n')
|
|
|
|
fromfile=before_header,
|
|
|
|
|
|
|
|
tofile=after_header,
|
|
|
|
|
|
|
|
fromfiledate='',
|
|
|
|
|
|
|
|
tofiledate='',
|
|
|
|
|
|
|
|
n=10)
|
|
|
|
|
|
|
|
difflines = list(differ)
|
|
|
|
|
|
|
|
if difflines:
|
|
|
|
|
|
|
|
ret.extend(difflines)
|
|
|
|
|
|
|
|
ret.append('\n')
|
|
|
|
if 'prepared' in diff:
|
|
|
|
if 'prepared' in diff:
|
|
|
|
ret.append(to_unicode(diff['prepared']))
|
|
|
|
ret.append(to_unicode(diff['prepared']))
|
|
|
|
return u"".join(ret)
|
|
|
|
|
|
|
|
except UnicodeDecodeError:
|
|
|
|
except UnicodeDecodeError:
|
|
|
|
ret.append(">> the files are different, but the diff library cannot compare unicode strings\n\n")
|
|
|
|
ret.append(">> the files are different, but the diff library cannot compare unicode strings\n\n")
|
|
|
|
|
|
|
|
return u''.join(ret)
|
|
|
|
|
|
|
|
|
|
|
|
def _get_item(self, result):
|
|
|
|
def _get_item(self, result):
|
|
|
|
if result.get('_ansible_no_log', False):
|
|
|
|
if result.get('_ansible_no_log', False):
|
|
|
|