From 40c6191da6c0b470716c18e21886ae624d58acb3 Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Thu, 5 Jan 2017 00:04:34 +0100 Subject: [PATCH] win_template: fix key errors when --diff is used --- lib/ansible/plugins/action/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index d9e5b095ef..4753cc930c 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -810,11 +810,11 @@ class ActionBase(with_metaclass(ABCMeta, object)): if not peek_result.get('failed', False) or peek_result.get('rc', 0) == 0: - if peek_result['state'] == 'absent': + if peek_result.get('state') == 'absent': diff['before'] = '' - elif peek_result['appears_binary']: + elif peek_result.get('appears_binary'): diff['dst_binary'] = 1 - elif C.MAX_FILE_SIZE_FOR_DIFF > 0 and peek_result['size'] > C.MAX_FILE_SIZE_FOR_DIFF: + elif peek_result.get('size') and C.MAX_FILE_SIZE_FOR_DIFF > 0 and peek_result['size'] > C.MAX_FILE_SIZE_FOR_DIFF: diff['dst_larger'] = C.MAX_FILE_SIZE_FOR_DIFF else: display.debug("Slurping the file %s" % source)