Fix the error on 'stop and delete container'

Change-Id: I0bb027d175c752a9a0980f4cbf2ebd688e7e2977
Closes-Bug: #1762068
This commit is contained in:
Hongbin Lu
2018-04-07 20:58:35 +00:00
parent b49c32def3
commit 21187bb0a8

View File

@@ -91,6 +91,19 @@ class ContainerActions(generic.View):
elif action == 'network_detach':
return client.container_network_detach(request, id)
@rest_utils.ajax(data_required=True)
def delete(self, request, id, action):
"""Delete specified Container with option.
Returns HTTP 204 (no content) on successful deletion.
"""
opts = {'id': id}
if action == 'force':
opts['force'] = True
elif action == 'stop':
opts['stop'] = True
return client.container_delete(request, **opts)
@urls.register
class Containers(generic.View):