From 680cade77af460130e1dd8fd7936a9d95960363e Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 25 Oct 2016 23:28:20 -0400 Subject: [PATCH] simplified the code by removing repeats (cherry picked from commit 84380b0ee4029212fc1637c008e07bb9958305c3) --- lib/ansible/plugins/action/fetch.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/ansible/plugins/action/fetch.py b/lib/ansible/plugins/action/fetch.py index 69cec30742..2d32744294 100644 --- a/lib/ansible/plugins/action/fetch.py +++ b/lib/ansible/plugins/action/fetch.py @@ -121,31 +121,23 @@ class ActionModule(ActionBase): if remote_checksum in ('0', '1', '2', '3', '4'): # these don't fail because you may want to transfer a log file that # possibly MAY exist but keep going to fetch other log files + result['changed'] = False + result['file'] = source if remote_checksum == '0': result['msg'] = "unable to calculate the checksum of the remote file" - result['file'] = source - result['changed'] = False elif remote_checksum == '1': if fail_on_missing: result['failed'] = True + del result['changed'] result['msg'] = "the remote file does not exist" - result['file'] = source else: result['msg'] = "the remote file does not exist, not transferring, ignored" - result['file'] = source - result['changed'] = False elif remote_checksum == '2': result['msg'] = "no read permission on remote file, not transferring, ignored" - result['file'] = source - result['changed'] = False elif remote_checksum == '3': result['msg'] = "remote file is a directory, fetch cannot work on directories" - result['file'] = source - result['changed'] = False elif remote_checksum == '4': result['msg'] = "python isn't present on the system. Unable to compute checksum" - result['file'] = source - result['changed'] = False return result # calculate checksum for the local file