fix to work like copy module
This commit is contained in:
parent
9e3f8670f7
commit
a5b199e07b
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):
|
||||
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:
|
||||
|
|
Loading…
Reference in a new issue