4006: return s3 url even if file exists
This commit is contained in:
parent
047164adac
commit
4b4b9551d0
1 changed files with 3 additions and 3 deletions
6
cloud/s3
6
cloud/s3
|
@ -231,12 +231,12 @@ def download_s3str(module, s3, bucket, obj):
|
||||||
except s3.provider.storage_copy_error, e:
|
except s3.provider.storage_copy_error, e:
|
||||||
module.fail_json(msg= str(e))
|
module.fail_json(msg= str(e))
|
||||||
|
|
||||||
def get_download_url(module, s3, bucket, obj, expiry):
|
def get_download_url(module, s3, bucket, obj, expiry, changed=True):
|
||||||
try:
|
try:
|
||||||
bucket = s3.lookup(bucket)
|
bucket = s3.lookup(bucket)
|
||||||
key = bucket.lookup(obj)
|
key = bucket.lookup(obj)
|
||||||
url = key.generate_url(expiry)
|
url = key.generate_url(expiry)
|
||||||
module.exit_json(msg="Download url:", url=url, expiry=expiry, changed=True)
|
module.exit_json(msg="Download url:", url=url, expiry=expiry, changed=changed)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
except s3.provider.storage_response_error, e:
|
except s3.provider.storage_response_error, e:
|
||||||
module.fail_json(msg= str(e))
|
module.fail_json(msg= str(e))
|
||||||
|
@ -378,7 +378,7 @@ def main():
|
||||||
if overwrite is True:
|
if overwrite is True:
|
||||||
upload_s3file(module, s3, bucket, obj, src, expiry)
|
upload_s3file(module, s3, bucket, obj, src, expiry)
|
||||||
else:
|
else:
|
||||||
module.exit_json(msg="Local and remote object are identical, ignoring. Use overwrite parameter to force.", changed=False)
|
get_download_url(module, s3, bucket, obj, expiry, changed=False) ## PATCH
|
||||||
else:
|
else:
|
||||||
sum_matches = False
|
sum_matches = False
|
||||||
if overwrite is True:
|
if overwrite is True:
|
||||||
|
|
Loading…
Reference in a new issue