Merge "Container action response 500"

This commit is contained in:
Zuul 2017-10-31 02:35:52 +00:00 committed by Gerrit Code Review
commit b50ed099b9

View File

@ -43,6 +43,14 @@ def is_not_found(e):
return '404' in str(e)
def is_conflict(e):
conflict_infos = ['not running', 'not paused', 'paused']
for info in conflict_infos:
if info in str(e):
return True
return False
def handle_not_found(e, context, container, do_not_raise=False):
if container.auto_remove:
container.status = consts.DELETED
@ -68,6 +76,8 @@ def wrap_docker_error(function):
except exception.DockerError as e:
if is_not_found(e):
handle_not_found(e, context, container)
if is_conflict(e):
raise exception.Conflict(_("%s") % str(e))
raise
return decorated_function