From 847811ded8ac61a93a0cc7d2011d4f640513408b Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 27 Jul 2025 15:19:15 +0200 Subject: [PATCH] Fix collecting data sources defined by dashboard variables --- CHANGES.rst | 2 ++ grafana_wtf/core.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index bf93aa1..5dceb71 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -7,6 +7,8 @@ in progress =========== - Fixed 404 error on "dash-folder" type when enumerating dashboards. Thanks, @oxy-star and @GarbageYard. +- Fixed collecting data sources defined by dashboard variables. Thanks, + @GrgDev, @cronosnull, and @nikodemas. 2025-03-18 0.23.0 ================= diff --git a/grafana_wtf/core.py b/grafana_wtf/core.py index 2aa804b..47389c7 100644 --- a/grafana_wtf/core.py +++ b/grafana_wtf/core.py @@ -715,10 +715,10 @@ def add(item): # Datasources defined as variables. if "type" in node and node["type"] == "datasource": values = to_list(node.get("current", {}).get("value")) - for ds_uid in values: - datasource = self.datasource_by_uid.get(ds_uid) + for ds_name in values: + datasource = self.datasource_by_name.get(ds_name) if datasource is None: - log.warning(f"Data source '{ds_uid}' not found") + log.warning(f"Data source '{ds_name}' not found") continue ds = dict( type=datasource.get("type"),