4006: return s3 url even if file exists

This commit is contained in:
James Tanner 2013-10-09 12:10:33 -04:00
parent 948d019fef
commit 9c3fb9c2b7

View file

@ -231,12 +231,12 @@ def download_s3str(module, s3, bucket, obj):
except s3.provider.storage_copy_error, 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:
bucket = s3.lookup(bucket)
key = bucket.lookup(obj)
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)
except s3.provider.storage_response_error, e:
module.fail_json(msg= str(e))
@ -378,7 +378,7 @@ def main():
if overwrite is True:
upload_s3file(module, s3, bucket, obj, src, expiry)
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:
sum_matches = False
if overwrite is True: