Skip to content

Commit

Permalink
Merge pull request #1071 from alesstimec/machine-charm-dashboard-rela…
Browse files Browse the repository at this point in the history
…tion-fix-02

Another fix for the dashboard relation.
  • Loading branch information
alesstimec authored Oct 25, 2023
2 parents 09d334d + 81b16c6 commit f8efcde
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions charms/jimm/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
BlockedStatus,
MaintenanceStatus,
ModelError,
Relation,
WaitingStatus,
)

Expand Down Expand Up @@ -133,13 +134,7 @@ def _on_config_changed(self, _):

dashboard_relation = self.model.get_relation("dashboard")
if dashboard_relation:
dashboard_relation.data[self.app].update(
{
"controller-url": "wss://{}".format(self.config["dns-name"]),
"identity-provider-url": self.config["candid-url"],
"is-juju": str(False),
}
)
self._update_dashboard_relation(dashboard_relation)

def _on_leader_elected(self, _):
"""Update the JIMM configuration that comes from unit
Expand Down Expand Up @@ -357,7 +352,11 @@ def _snap(self, *args):

def _on_dashboard_relation_joined(self, event):
if self.model.unit.is_leader():
event.relation.data[self.app].update(
self._update_dashboard_relation(event.relation)

def _update_dashboard_relation(self, relation: Relation):
if self.model.unit.is_leader():
relation.data[self.app].update(
{
"controller_url": "wss://{}".format(self.config["dns-name"]),
"identity_provider_url": self.config["candid-url"],
Expand Down

0 comments on commit f8efcde

Please sign in to comment.