Merge pull request #1046 from freyes/retry-list-images

Retry when listing glance images.
This commit is contained in:
Alex Kavanagh
2023-05-08 11:21:26 +01:00
committed by GitHub
2 changed files with 6 additions and 2 deletions

View File

@@ -14,11 +14,11 @@ pyopenssl<22.1.0
boto3<1.25
PyYAML<=4.2,>=3.0; python_version < '3.9'
PyYAML>=5.1; python_version >= '3.9'
flake8>=2.2.4
flake8>=5 # Python 3.8 compatibility in pyflakes 2.1.0+
flake8-docstrings
flake8-per-file-ignores
pydocstyle<4.0.0
coverage<6.0.0 # coverage 6.0+ drops support for py3.5/py2.7
coverage<6.0.0; python_version <= '3.5' # coverage 6.0+ drops support for py3.5/py2.7
mock>=1.2
pytest
pytest-cov

View File

@@ -53,6 +53,7 @@ from cinderclient import client as cinderclient
from heatclient import client as heatclient
from magnumclient import client as magnumclient
from glanceclient import Client as GlanceClient
from glanceclient.exc import CommunicationError
from designateclient.client import Client as DesignateClient
from keystoneclient.v2_0 import client as keystoneclient_v2
@@ -2333,6 +2334,9 @@ def get_urllib_opener():
return urllib.request.build_opener(handler)
@tenacity.retry(wait=tenacity.wait_exponential(multiplier=1, max=60),
reraise=True,
retry=tenacity.retry_if_exception_type(CommunicationError))
def get_images_by_name(glance, image_name):
"""Get all glance image objects with the given name.