Skip to content

Commit

Permalink
improve syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
kelkawi-a committed Jan 29, 2024
1 parent 749efa8 commit dc83305
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ def _validate_pebble_plan(self, container):
"""
try:
plan = container.get_plan().to_dict()
return bool(plan and plan["services"].get(self.name, {}).get("on-check-failure"))
except pebble.ConnectionError:
return bool(plan["services"][self.name]["on-check-failure"])
except (KeyError, pebble.ConnectionError):
return False

@log_event_handler(logger)
Expand Down

0 comments on commit dc83305

Please sign in to comment.