Skip to content

Commit

Permalink
Merge pull request #1125 from freyes/pr1119/xena
Browse files Browse the repository at this point in the history
Retry on ContentTooShortError [Xena backport]
  • Loading branch information
ajkavanagh authored Sep 11, 2023
2 parents fe5fa60 + 2a38a72 commit 47d18a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion zaza/openstack/charm_tests/ceilometer/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def test_900_restart_on_config_change(self):
current_value = openstack_utils.get_application_config_option(
self.application_name, config_name
)
assert type(current_value) is bool
self.assertIsInstance(current_value, bool)
new_value = not current_value

# Convert bool to str
Expand Down
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 47d18a2

Please sign in to comment.