Skip to content

Commit

Permalink
Merge branch 'main' into rel-210
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemental authored Aug 7, 2024
2 parents 60c6332 + e878b5a commit ab8326d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/392-dashboard-lookup-apikey.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- Fixed check if grafana_api_key is defined for `grafana_dashboard` lookup
4 changes: 2 additions & 2 deletions plugins/lookup/grafana_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def grafana_switch_organisation(self, headers):

def grafana_headers(self):
headers = {"content-type": "application/json; charset=utf8"}
if self.grafana_api_key.get("grafana_api_key", None):
if self.grafana_api_key:
headers["Authorization"] = "Bearer %s" % self.grafana_api_key
else:
headers["Authorization"] = basic_auth_header(
Expand Down Expand Up @@ -222,9 +222,9 @@ def run(self, terms, variables=None, **kwargs):
grafana_dict[key] = value

grafana = GrafanaAPI(
**grafana_dict,
validate_certs=self.get_option("validate_certs"),
ca_path=self.get_option("ca_path"),
**grafana_dict,
)

ret = grafana.grafana_list_dashboards()
Expand Down

0 comments on commit ab8326d

Please sign in to comment.