mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Use the common/shared MD5 function.
This commit is contained in:
parent
f15ce1433a
commit
8b60dd349d
2 changed files with 5 additions and 13 deletions
|
@ -291,7 +291,7 @@ def get_download_url(module, gs, bucket, obj, expiry):
|
|||
|
||||
def handle_get(module, gs, bucket, obj, overwrite, dest):
|
||||
md5_remote = keysum(module, gs, bucket, obj)
|
||||
md5_local = hashlib.md5(open(dest, 'rb').read()).hexdigest()
|
||||
md5_local = module.md5(dest)
|
||||
if md5_local == md5_remote:
|
||||
module.exit_json(changed=False)
|
||||
if md5_local != md5_remote and not overwrite:
|
||||
|
@ -307,7 +307,7 @@ def handle_put(module, gs, bucket, obj, overwrite, src, expiration):
|
|||
# Lets check key state. Does it exist and if it does, compute the etag md5sum.
|
||||
if bucket_rc and key_rc:
|
||||
md5_remote = keysum(module, gs, bucket, obj)
|
||||
md5_local = hashlib.md5(open(src, 'rb').read()).hexdigest()
|
||||
md5_local = module.md5(src)
|
||||
if md5_local == md5_remote:
|
||||
module.exit_json(msg="Local and remote object are identical", changed=False)
|
||||
if md5_local != md5_remote and not overwrite:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue