module.exit_json(msg="Local and remote object are identical, ignoring. Use overwrite parameter to force.",changed=False)
else:
sum_matches=False
ifoverwriteisTrue:
download_s3file(module,s3,bucket,obj,dest)
else:
module.fail_json(msg="WARNING: Checksums do not match. Use overwrite parameter to force download.",failed=True)
ifkey_existsisTrueandoverwrite:
# Retrieve MD5 Checksums.
md5_remote=key_check.etag[1:-1]# Strip Quotation marks from etag: https://code.google.com/p/boto/issues/detail?id=391
etag_multipart=md5_remote.find('-')!=-1# Find out if this is a multipart upload -> etag is not md5: https://forums.aws.amazon.com/message.jspa?messageID=222158
ifetag_multipartisTrue:
module.fail_json(msg="Files uploaded with multipart to s3 are not supported with checksum. They do not contain a valid md5 checksum, use overwrite=no instead.")
# If destination file doesn't already exist we can go ahead and download.
ifpathrtnisFalse:
download_s3file(module,s3,bucket,obj,dest)
# Firstly, if key_matches is TRUE and overwrite is not enabled, we EXIT with a helpful message.
ifsum_matchesisTrueandoverwriteisFalse:
module.exit_json(msg="Local and remote object are identical, ignoring. Use overwrite parameter to force.",changed=False)
# At this point explicitly define the overwrite condition.