Merge pull request #35807 from ClickHouse/docker-pull-latest-error

Fix latest_error referenced before assignment
This commit is contained in:
alesapin 2022-04-01 11:25:54 +02:00 committed by GitHub
commit 61a0becae5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,18 +56,20 @@ def get_images_with_versions(
for i in range(10):
try:
logging.info("Pulling image %s", docker_image)
latest_error = subprocess.check_output(
subprocess.check_output(
f"docker pull {docker_image}",
stderr=subprocess.STDOUT,
shell=True,
)
break
except Exception as ex:
latest_error = ex
time.sleep(i * 3)
logging.info("Got execption pulling docker %s", ex)
else:
raise Exception(
f"Cannot pull dockerhub for image docker pull {docker_image} because of {latest_error}"
"Cannot pull dockerhub for image docker pull "
f"{docker_image} because of {latest_error}"
)
return docker_images