mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fix to work like copy module
This commit is contained in:
parent
788e783b6d
commit
0c275424c6
1 changed files with 3 additions and 3 deletions
|
@ -263,7 +263,7 @@ def get_download_url(module, gs, bucket, obj, expiry):
|
||||||
def handle_get(module, gs, bucket, obj, overwrite, dest):
|
def handle_get(module, gs, bucket, obj, overwrite, dest):
|
||||||
md5_remote = keysum(module, gs, bucket, obj)
|
md5_remote = keysum(module, gs, bucket, obj)
|
||||||
md5_local = hashlib.md5(open(dest, 'rb').read()).hexdigest()
|
md5_local = hashlib.md5(open(dest, 'rb').read()).hexdigest()
|
||||||
if md5_local == md5_remote and not overwrite:
|
if md5_local == md5_remote:
|
||||||
module.exit_json(changed=False)
|
module.exit_json(changed=False)
|
||||||
if md5_local != md5_remote and not overwrite:
|
if md5_local != md5_remote and not overwrite:
|
||||||
module.exit_json(msg="WARNING: Checksums do not match. Use overwrite parameter to force download.", failed=True)
|
module.exit_json(msg="WARNING: Checksums do not match. Use overwrite parameter to force download.", failed=True)
|
||||||
|
@ -279,8 +279,8 @@ def handle_put(module, gs, bucket, obj, overwrite, src, expiration):
|
||||||
if bucket_rc and key_rc:
|
if bucket_rc and key_rc:
|
||||||
md5_remote = keysum(module, gs, bucket, obj)
|
md5_remote = keysum(module, gs, bucket, obj)
|
||||||
md5_local = hashlib.md5(open(src, 'rb').read()).hexdigest()
|
md5_local = hashlib.md5(open(src, 'rb').read()).hexdigest()
|
||||||
if md5_local == md5_remote and not overwrite:
|
if md5_local == md5_remote:
|
||||||
module.exit_json(msg="Local and remote object are identical. Use overwrite to force upload", changed=False)
|
module.exit_json(msg="Local and remote object are identical", changed=False)
|
||||||
if md5_local != md5_remote and not overwrite:
|
if md5_local != md5_remote and not overwrite:
|
||||||
module.exit_json(msg="WARNING: Checksums do not match. Use overwrite parameter to force upload.", failed=True)
|
module.exit_json(msg="WARNING: Checksums do not match. Use overwrite parameter to force upload.", failed=True)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue