mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
Add error when checksumming will fail because python is not present on the remote.
Comments for how the remote checksumming works. Make the checksumming marginally more robust.
This commit is contained in:
parent
565e5bbdfc
commit
d4d23b1b1f
2 changed files with 33 additions and 15 deletions
|
@ -114,19 +114,22 @@ class ActionModule(object):
|
|||
|
||||
dest = dest.replace("//","/")
|
||||
|
||||
# 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
|
||||
if remote_checksum == '0':
|
||||
result = dict(msg="unable to calculate the checksum of the remote file", file=source, changed=False)
|
||||
return ReturnData(conn=conn, result=result)
|
||||
if remote_checksum == '1':
|
||||
if fail_on_missing:
|
||||
result = dict(failed=True, msg="the remote file does not exist", file=source)
|
||||
else:
|
||||
result = dict(msg="the remote file does not exist, not transferring, ignored", file=source, changed=False)
|
||||
return ReturnData(conn=conn, result=result)
|
||||
if remote_checksum == '2':
|
||||
result = dict(msg="no read permission on remote file, not transferring, ignored", file=source, changed=False)
|
||||
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
|
||||
if remote_checksum == '0':
|
||||
result = dict(msg="unable to calculate the checksum of the remote file", file=source, changed=False)
|
||||
elif remote_checksum == '1':
|
||||
if fail_on_missing:
|
||||
result = dict(failed=True, msg="the remote file does not exist", file=source)
|
||||
else:
|
||||
result = dict(msg="the remote file does not exist, not transferring, ignored", file=source, changed=False)
|
||||
elif remote_checksum == '2':
|
||||
result = dict(msg="no read permission on remote file, not transferring, ignored", file=source, changed=False)
|
||||
elif remote_checksum == '3':
|
||||
result = dict(msg="remote file is a directory, fetch cannot work on directories", file=source, changed=False)
|
||||
elif remote_checksum == '4':
|
||||
result = dict(msg="python isn't present on the remote system. Unable to fetch file", file=source, changed=False)
|
||||
return ReturnData(conn=conn, result=result)
|
||||
|
||||
# calculate checksum for the local file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue