Merge "Raise 409 exception while deleting running container"
This commit is contained in:
commit
3d34c84c2e
@ -339,3 +339,9 @@ class ContainerNotFound(HTTPNotFound):
|
||||
|
||||
class ContainerAlreadyExists(ResourceExists):
|
||||
message = _("A container with UUID %(uuid)s already exists.")
|
||||
|
||||
|
||||
class ContainerRunningException(ZunException):
|
||||
message = _("The container %(id)s is running."
|
||||
"Please stop and delete the container.")
|
||||
code = 409
|
||||
|
@ -72,6 +72,9 @@ class Manager(object):
|
||||
return container
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Unexpected exception: %s"), str(e))
|
||||
if e.response.status_code == 409:
|
||||
raise exception.ContainerRunningException(
|
||||
id=container.container_id)
|
||||
raise e
|
||||
|
||||
@translate_exception
|
||||
|
Loading…
Reference in New Issue
Block a user