Skip to content

Commit

Permalink
Retry on ContentTooShortError
Browse files Browse the repository at this point in the history
This patch makes the download_image() to retry automatically on
ContentTooShortError exception, this is an issue that has been seen on
the gate, see [0].

[0] https://openstack-ci-reports.ubuntu.com/artifacts/3ae/891712/3/check/focal-wallaby-pacemaker-remote-ssl_masakari/3ae840c/job-output.txt

(cherry picked from commit 91c1cc3)
  • Loading branch information
freyes committed Sep 8, 2023
1 parent fe5fa60 commit 2ed2c4f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions zaza/openstack/utilities/openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -2254,6 +2254,12 @@ def find_ubuntu_image(release, arch):
return UBUNTU_IMAGE_URLS[release].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.
Expand Down

0 comments on commit 2ed2c4f

Please sign in to comment.