From ae09f331a2c070f8b5dfa41b04db448d9175536e Mon Sep 17 00:00:00 2001 From: Noctua Date: Thu, 23 Jan 2025 21:04:39 +0100 Subject: [PATCH] chore: update charm libraries (#243) --- lib/charms/grafana_k8s/v0/grafana_dashboard.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/charms/grafana_k8s/v0/grafana_dashboard.py b/lib/charms/grafana_k8s/v0/grafana_dashboard.py index e79bd99..cc22f9f 100644 --- a/lib/charms/grafana_k8s/v0/grafana_dashboard.py +++ b/lib/charms/grafana_k8s/v0/grafana_dashboard.py @@ -219,7 +219,7 @@ def __init__(self, *args): # Increment this PATCH version before using `charmcraft publish-lib` or reset # to 0 if you are raising the major API version -LIBPATCH = 38 +LIBPATCH = 39 PYDEPS = ["cosl >= 0.0.50"] @@ -1665,8 +1665,10 @@ def set_peer_data(self, key: str, data: Any) -> None: def get_peer_data(self, key: str) -> Any: """Retrieve information from the peer data bucket instead of `StoredState`.""" - data = self._charm.peers.data[self._charm.app].get(key, "") # type: ignore[attr-defined] - return json.loads(data) if data else {} + if rel := self._charm.peers: # type: ignore[attr-defined] + data = rel.data[self._charm.app].get(key, "") + return json.loads(data) if data else {} + return {} class GrafanaDashboardAggregator(Object):