Skip to content

Commit

Permalink
Add handling for HTTP request failure when acquiring lock (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlcsaposs-canonical authored Apr 22, 2024
1 parent 90444e3 commit cb4c212
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/charms/opensearch/v0/opensearch_locking.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,11 @@ def acquired(self) -> bool: # noqa: C901
else:
logger.exception("Error creating OpenSearch lock document")
return False
unit = self._unit_with_lock(host)
try:
unit = self._unit_with_lock(host)
except OpenSearchHttpError:
logger.exception("Error checking which unit has OpenSearch lock")
return False
if unit == self._charm.unit.name:
# Lock acquired
# Release peer databag lock, if any
Expand Down

0 comments on commit cb4c212

Please sign in to comment.