1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #14864 from dagwieers/patch-12

Only show diff when the task actually induced a change
This commit is contained in:
James Cammarata 2016-03-08 15:02:49 -05:00
commit aee2eb6287

View file

@ -150,11 +150,11 @@ class CallbackModule(CallbackBase):
def v2_on_file_diff(self, result): def v2_on_file_diff(self, result):
if result._task.loop and 'results' in result._result: if result._task.loop and 'results' in result._result:
for res in result._result['results']: for res in result._result['results']:
if 'diff' in res and res['diff']: if 'diff' in res and res['diff'] and res.get('changed', False):
diff = self._get_diff(res['diff']) diff = self._get_diff(res['diff'])
if diff: if diff:
self._display.display(diff) self._display.display(diff)
elif 'diff' in result._result and result._result['diff']: elif 'diff' in result._result and result._result['diff'] and result._result.get('changed', False):
diff = self._get_diff(result._result['diff']) diff = self._get_diff(result._result['diff'])
if diff: if diff:
self._display.display(diff) self._display.display(diff)