From b2f0448e57e34b12f290bced15cea9caa2e7aa75 Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Mon, 3 Apr 2017 19:56:21 +0000 Subject: [PATCH] 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 --- zun_ui/api/client.py | 8 ++++---- zun_ui/api/rest_api.py | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/zun_ui/api/client.py b/zun_ui/api/client.py index a81f01d..bfcf7ce 100644 --- a/zun_ui/api/client.py +++ b/zun_ui/api/client.py @@ -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): diff --git a/zun_ui/api/rest_api.py b/zun_ui/api/rest_api.py index 7446910..0b1ea7e 100644 --- a/zun_ui/api/rest_api.py +++ b/zun_ui/api/rest_api.py @@ -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)