Skip to content

Commit

Permalink
Fix for the stop method.
Browse files Browse the repository at this point in the history
  • Loading branch information
alesstimec committed Jul 10, 2023
1 parent a7fe32f commit bba538f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions charms/jimm-k8s/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, _):
Expand Down

0 comments on commit bba538f

Please sign in to comment.