Skip to content

Commit

Permalink
simplified the code by removing repeats
Browse files Browse the repository at this point in the history
(cherry picked from commit 84380b0ee4029212fc1637c008e07bb9958305c3)
  • Loading branch information
bcoca committed Oct 27, 2016
1 parent c47d580 commit 680cade
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions lib/ansible/plugins/action/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,31 +121,23 @@ def run(self, tmp=None, task_vars=None):
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
Expand Down

0 comments on commit 680cade

Please sign in to comment.