|
|
|
@ -124,14 +124,14 @@ def url_filename(url):
|
|
|
|
|
return 'index.html'
|
|
|
|
|
return fn
|
|
|
|
|
|
|
|
|
|
def url_get(module, url, dest, use_proxy, last_mod_time, force, validate_certs):
|
|
|
|
|
def url_get(module, url, dest, use_proxy, last_mod_time, force):
|
|
|
|
|
"""
|
|
|
|
|
Download data from the url and store in a temporary file.
|
|
|
|
|
|
|
|
|
|
Return (tempfile, info about the request)
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
rsp, info = fetch_url(module, url, use_proxy=use_proxy, force=force, last_mod_time=last_mod_time, validate_certs=validate_certs)
|
|
|
|
|
rsp, info = fetch_url(module, url, use_proxy=use_proxy, force=force, last_mod_time=last_mod_time)
|
|
|
|
|
|
|
|
|
|
if info['status'] == 304:
|
|
|
|
|
module.exit_json(url=url, dest=dest, changed=False, msg=info.get('msg', ''))
|
|
|
|
@ -192,7 +192,6 @@ def main():
|
|
|
|
|
force = module.params['force']
|
|
|
|
|
sha256sum = module.params['sha256sum']
|
|
|
|
|
use_proxy = module.params['use_proxy']
|
|
|
|
|
validate_certs = module.params['validate_certs']
|
|
|
|
|
|
|
|
|
|
dest_is_dir = os.path.isdir(dest)
|
|
|
|
|
last_mod_time = None
|
|
|
|
@ -207,7 +206,7 @@ def main():
|
|
|
|
|
last_mod_time = datetime.datetime.utcfromtimestamp(mtime)
|
|
|
|
|
|
|
|
|
|
# download to tmpsrc
|
|
|
|
|
tmpsrc, info = url_get(module, url, dest, use_proxy, last_mod_time, force, validate_certs)
|
|
|
|
|
tmpsrc, info = url_get(module, url, dest, use_proxy, last_mod_time, force)
|
|
|
|
|
|
|
|
|
|
# Now the request has completed, we can finally generate the final
|
|
|
|
|
# destination file name from the info dict.
|
|
|
|
|