|
|
|
@ -263,7 +263,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()
|
|
|
|
|
if md5_local == md5_remote and not overwrite:
|
|
|
|
|
if md5_local == md5_remote:
|
|
|
|
|
module.exit_json(changed=False)
|
|
|
|
|
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)
|
|
|
|
@ -279,8 +279,8 @@ def handle_put(module, gs, bucket, obj, overwrite, src, expiration):
|
|
|
|
|
if bucket_rc and key_rc:
|
|
|
|
|
md5_remote = keysum(module, gs, bucket, obj)
|
|
|
|
|
md5_local = hashlib.md5(open(src, 'rb').read()).hexdigest()
|
|
|
|
|
if md5_local == md5_remote and not overwrite:
|
|
|
|
|
module.exit_json(msg="Local and remote object are identical. Use overwrite to force upload", changed=False)
|
|
|
|
|
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:
|
|
|
|
|
module.exit_json(msg="WARNING: Checksums do not match. Use overwrite parameter to force upload.", failed=True)
|
|
|
|
|
else:
|
|
|
|
|