From bba538f78b8a98b1a4aafb471a8961211673c740 Mon Sep 17 00:00:00 2001 From: alesstimec Date: Mon, 10 Jul 2023 14:33:13 +0200 Subject: [PATCH] Fix for the stop method. --- charms/jimm-k8s/src/charm.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/charms/jimm-k8s/src/charm.py b/charms/jimm-k8s/src/charm.py index e63da0595..6663a9bcb 100755 --- a/charms/jimm-k8s/src/charm.py +++ b/charms/jimm-k8s/src/charm.py @@ -333,9 +333,12 @@ def _on_start(self, event): def _on_stop(self, _): """Stop JIMM.""" - container = self.unit.get_container(WORKLOAD_CONTAINER) - if container.can_connect(): - container.stop("jimm") + try: + container = self.unit.get_container(WORKLOAD_CONTAINER) + if container.can_connect(): + container.stop("jimm") + except Exception as e: + logger.info("failed to stop the jimm service: {}".format(e)) self._ready() def _on_update_status(self, _):