Skip to content

Commit

Permalink
fix: remove unnecessary leadership guards in GrafanaCloudConfigRequirer
Browse files Browse the repository at this point in the history
Previously, GrafanaCloudConfigRequirer would only emit a cloud_config_* event on relation changed/broken if this unit is a leader.  This caused issues with multi-unit deployments as described in [#12](#12).  Since GrafanaCloudConfigRequirer only reads the relation remote's application_data, there is no need for a leadership guard because non-leader units have permission to read this data.  The current commit removes these guards.
  • Loading branch information
ca-scribner committed Aug 14, 2024
1 parent 545e53b commit 9bb6da5
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

LIBID = "e6f580481c1b4388aa4d2cdf412a47fa"
LIBAPI = 0
LIBPATCH = 4
LIBPATCH = 5

DEFAULT_RELATION_NAME = "grafana-cloud-config"

Expand Down Expand Up @@ -53,15 +53,9 @@ def __init__(self, charm, relation_name = DEFAULT_RELATION_NAME):
self.framework.observe(event, self._on_relation_broken)

def _on_relation_changed(self, event):
if not self._charm.unit.is_leader():
return

self.on.cloud_config_available.emit() # pyright: ignore

def _on_relation_broken(self, event):
if not self._charm.unit.is_leader():
return

self.on.cloud_config_revoked.emit() # pyright: ignore

def _is_not_empty(self, s):
Expand Down

0 comments on commit 9bb6da5

Please sign in to comment.