Merge pull request #1119 from freyes/content-too-short

Retry on ContentTooShort
This commit is contained in:
Alex Kavanagh
2023-09-08 08:42:46 +01:00
committed by GitHub

View File

@@ -2410,6 +2410,12 @@ def find_ubuntu_image(release, arch):
return loc_str.format(release=release, arch=arch)
@tenacity.retry(
wait=tenacity.wait_fixed(2),
stop=tenacity.stop_after_attempt(10),
reraise=True,
retry=tenacity.retry_if_exception_type(urllib.error.ContentTooShortError),
)
def download_image(image_url, target_file):
"""Download the image from the given url to the specified file.