Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry on ContentTooShortError [Train backport] #1129

Open
wants to merge 2 commits into
base: stable/train
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) == 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 @@ -2241,6 +2241,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
Loading