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
  • Loading branch information
freyes committed Sep 7, 2023
1 parent a07fb40 commit 91c1cc3
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 @@ -2398,6 +2398,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.
Expand Down

0 comments on commit 91c1cc3

Please sign in to comment.