Skip to content

Commit

Permalink
Merge pull request #1082 from vantage6/bugfix/prevent-error-when-remo…
Browse files Browse the repository at this point in the history
…ving-docker-volumes

Prevent error when volume that normally exists doesn't exist when shu…
  • Loading branch information
bartvanb committed Mar 11, 2024
2 parents 5be7a73 + 1a6a079 commit fed6b6c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions vantage6-common/vantage6/common/docker/addons.py
Expand Up @@ -518,10 +518,9 @@ def delete_volume_if_exists(client: docker.DockerClient, volume_name: Volume) ->
volume: Volume
Volume to delete
"""
# get docker volume from name
volume = client.volumes.get(volume_name)
if volume:
try:
try:
volume = client.volumes.get(volume_name)
if volume:
volume.remove()
except (docker.errors.NotFound, docker.errors.APIError):
log.warning("Could not delete volume %s", volume.name)
except (docker.errors.NotFound, docker.errors.APIError):
log.warning("Could not delete volume %s", volume.name)

0 comments on commit fed6b6c

Please sign in to comment.