Fixed the error on stop reboot and kill

For stop and reboot, the timeout parameter is missing. For kill,
it doesn't work if users left the signal unspecified.

Change-Id: Ia1db001790fc491982ba4a6377bea2684d18f610
This commit is contained in:
Hongbin Lu 2017-04-03 19:56:21 +00:00
parent dc4ed360f8
commit b2f0448e57
2 changed files with 9 additions and 7 deletions

View File

@ -103,12 +103,12 @@ def container_start(request, id):
return zunclient(request).containers.start(id)
def container_stop(request, id):
return zunclient(request).containers.stop(id)
def container_stop(request, id, timeout):
return zunclient(request).containers.stop(id, timeout)
def container_reboot(request, id):
return zunclient(request).containers.reboot(id)
def container_reboot(request, id, timeout):
return zunclient(request).containers.reboot(id, timeout)
def container_pause(request, id):

View File

@ -64,9 +64,11 @@ class ContainerActions(generic.View):
if action == 'start':
return client.container_start(request, id)
elif action == 'stop':
return client.container_stop(request, id)
timeout = 10
return client.container_stop(request, id, timeout)
elif action == 'reboot':
return client.container_reboot(request, id)
timeout = 10
return client.container_reboot(request, id, timeout)
elif action == 'pause':
return client.container_pause(request, id)
elif action == 'unpause':
@ -75,7 +77,7 @@ class ContainerActions(generic.View):
command = request.DATA.get("command")
return client.container_execute(request, id, command)
elif action == 'kill':
signal = request.DATA.get("signal")
signal = request.DATA.get("signal") or None
return client.container_kill(request, id, signal)