Skip to content

Commit aeece73

Browse files
committed
Folder Import: Fix software tests. Add change log item.
1 parent c3ad715 commit aeece73

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
# History
44

55
## Unreleased
6+
- Fixed folder argument issue
7+
- Fixed import dashboards into a folder
8+
9+
Thanks, @vrymar.
610

711
## 0.3.0 (2024-10-03)
812
* Permit invocation without configuration file for ad hoc operations.

grafana_import/util.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,21 @@ def grafana_settings(
5050

5151
# Grafana connectivity.
5252
if url or "GRAFANA_URL" in os.environ:
53-
params = {"url": url or os.environ["GRAFANA_URL"]}
54-
if "GRAFANA_TOKEN" in os.environ:
55-
params.update({"token": os.environ["GRAFANA_TOKEN"]})
56-
elif config is not None:
53+
params.update({"url": url or os.environ["GRAFANA_URL"]})
54+
if "GRAFANA_TOKEN" in os.environ:
55+
params.update({"token": os.environ["GRAFANA_TOKEN"]})
56+
57+
if not params and config is not None and label is not None:
5758
params = grafana_settings_from_config_section(config=config, label=label)
5859

5960
# Additional application parameters.
60-
params.update(
61-
{
62-
"search_api_limit": config.get("grafana", {}).get("search_api_limit", 5000),
63-
"folder": config.get("general", {}).get("grafana_folder", "General"),
64-
}
65-
)
61+
if config is not None:
62+
params.update(
63+
{
64+
"search_api_limit": config.get("grafana", {}).get("search_api_limit", 5000),
65+
"folder": config.get("general", {}).get("grafana_folder", "General"),
66+
}
67+
)
6668
return params
6769

6870

0 commit comments

Comments
 (0)