Fix latest_error referenced before assignment

This commit is contained in:
Mikhail f. Shiryaev 2022-03-31 15:40:32 +02:00
parent bd2ab32e3f
commit 4ba7cf6d1b
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4

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