Skip to content

Commit

Permalink
Again tweak detection of when an image doesn't exist.
Browse files Browse the repository at this point in the history
Let's see if this fragile nonsense breaks again.

What was here though was hiding containers/podman#19930
(i.e. a real 500 error coming from a podman bug which was
being reported as the image not existing).
  • Loading branch information
Julian committed Sep 29, 2023
1 parent 6077960 commit a89c7d5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion bowtie/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,17 @@ async def start(
raise StartupFailed(name=image_name)
except aiodocker.exceptions.DockerError as error:
status, data, *_ = error.args # :/
if data.get("cause") == "image not known" or status == 500:
if data.get("cause") == "image not known":
raise NoSuchImage(name=image_name, data=data)

try: # GitHub Registry saying an image doesn't exist...
error = json.loads(data.get("message", "{}")).get("error", "")
except Exception:
pass
else:
if "403 (forbidden)" in error.casefold():
raise NoSuchImage(name=image_name, data=data)

raise StartupFailed(name=image_name, data=data)

yield self
Expand Down

0 comments on commit a89c7d5

Please sign in to comment.