diff --git a/src/charm.py b/src/charm.py index fa14665..2703d13 100755 --- a/src/charm.py +++ b/src/charm.py @@ -13,7 +13,7 @@ from charms.loki_k8s.v1.loki_push_api import LokiPushApiProvider from charms.prometheus_k8s.v0.prometheus_scrape import MetricsEndpointConsumer from charms.tempo_coordinator_k8s.v0.charm_tracing import trace_charm -from cosl import GrafanaDashboard +from cosl import LZMABase64 from ops.main import main from ops.pebble import Layer @@ -32,7 +32,7 @@ GrafanaAgentCharm, LokiPushApiProvider, MetricsEndpointConsumer, - GrafanaDashboard, + LZMABase64, ), ) class GrafanaAgentK8sCharm(GrafanaAgentCharm): @@ -156,9 +156,9 @@ def dashboards(self) -> list: if "templates" not in dashboards: continue for template in dashboards["templates"]: - content = GrafanaDashboard( + content = json.loads(LZMABase64.decompress( dashboards["templates"][template].get("content") - )._deserialize() + )) entry = { "charm": dashboards["templates"][template].get("charm", "charm_name"), "relation_id": rel.id, diff --git a/tests/scenario/test_dashboard_transfer.py b/tests/scenario/test_dashboard_transfer.py index c330732..78fffe0 100644 --- a/tests/scenario/test_dashboard_transfer.py +++ b/tests/scenario/test_dashboard_transfer.py @@ -2,12 +2,12 @@ # See LICENSE file for licensing details. import json -from cosl import GrafanaDashboard +from cosl import LZMABase64 from ops.testing import Container, Relation, State def encode_as_dashboard(dct: dict): - return GrafanaDashboard._serialize(json.dumps(dct).encode("utf-8")) + return LZMABase64.compress(json.dumps(dct)) def test_dashboard_propagation(ctx):