Skip to content

Commit

Permalink
Fixed undeploy when image doesnt exist anymore in API
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaudin committed Nov 4, 2024
1 parent 54166ab commit 16e5582
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/offspot_demo/undeploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
import logging
import shutil
import sys
from http import HTTPStatus

import requests.exceptions

from offspot_demo import logger
from offspot_demo.deploy import unmount_detach_release
Expand All @@ -20,6 +23,14 @@


def undeploy_for(deployment: Deployment, *, keep_image: bool):
try:
deployment.download_url # noqa: B018
except requests.exceptions.HTTPError as exc:
if exc.response.status_code == HTTPStatus.NOT_FOUND:
deployment._download_url = f"Gone image ({deployment.ident})" # pyright: ignore [reportPrivateUsage]

else:
raise exc
logger.info(f"undeploying for {deployment.download_url}")

if not is_root():
Expand Down

0 comments on commit 16e5582

Please sign in to comment.