From 96bcbea76b4a72563e73655f346d1e46b0d0fb06 Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Mon, 25 Nov 2024 10:40:20 +0100 Subject: [PATCH] updated return object type --- lib/charms/grafana_k8s/v0/grafana_source.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/charms/grafana_k8s/v0/grafana_source.py b/lib/charms/grafana_k8s/v0/grafana_source.py index 1f4a6960..aa1e92a9 100644 --- a/lib/charms/grafana_k8s/v0/grafana_source.py +++ b/lib/charms/grafana_k8s/v0/grafana_source.py @@ -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: