From ed5bbf9dd65c943b877e77ae06e0d7ec505a8ea2 Mon Sep 17 00:00:00 2001 From: Claus Ibsen Date: Mon, 1 Dec 2014 16:29:35 +0100 Subject: [PATCH] #177: Deleting a container should first use stop, before kill. --- .../java/io/fabric8/jube/local/NodeHelper.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/node/src/main/java/io/fabric8/jube/local/NodeHelper.java b/node/src/main/java/io/fabric8/jube/local/NodeHelper.java index aeaa653..efd8019 100644 --- a/node/src/main/java/io/fabric8/jube/local/NodeHelper.java +++ b/node/src/main/java/io/fabric8/jube/local/NodeHelper.java @@ -385,8 +385,22 @@ protected static void deleteContainer(ProcessManager processManager, KubernetesM return; } ProcessController controller = installation.getController(); - controller.kill(); - controller.uninstall(); + // try graceful to stop first, then kill afterwards + try { + controller.stop(); + } catch (Exception e) { + LOG.warn("Error during stopping container. Will now attempt to forcibly kill the container.", e); + } + try { + controller.kill(); + } catch (Exception e) { + LOG.warn("Error during killing container. Will now attempt to uninstall the container.", e); + } + try { + controller.uninstall(); + } catch (Exception e) { + + } model.deletePod(pod.getId()); }