Skip to content

Commit

Permalink
Merge pull request #994 from alesstimec/k8s-charm-stop-fix-01
Browse files Browse the repository at this point in the history
Fix for the stop method.
  • Loading branch information
alesstimec authored Jul 10, 2023
2 parents a7fe32f + bba538f commit 5132ed1
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 5132ed1

Please sign in to comment.