Skip to content

Commit

Permalink
updated return object type
Browse files Browse the repository at this point in the history
  • Loading branch information
PietroPasotti committed Nov 25, 2024
1 parent afff9aa commit 96bcbea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/charms/grafana_k8s/v0/grafana_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,13 +429,15 @@ def update_source(self, source_url: Optional[str] = ""):
continue
self._set_sources(rel)

def get_source_uids(self) -> Dict[Relation, Dict[str, str]]:
"""Get the datasource UID(s) assigned by the remote end(s) to this datasource."""
def get_source_uids(self) -> Dict[str, Dict[str, str]]:
"""Get the datasource UID(s) assigned by the remote end(s) to this datasource.
Returns a mapping from remote application names to unit names to datasource uids."""
uids = {}
for rel in self._charm.model.relations.get(self._relation_name, []):
if not rel:
continue
uids[rel] = json.loads(rel.data[rel.app]["datasource_uids"])
uids[rel.app.name] = json.loads(rel.data[rel.app]["datasource_uids"])
return uids

def _set_sources_from_event(self, event: RelationJoinedEvent) -> None:
Expand Down

0 comments on commit 96bcbea

Please sign in to comment.