Skip to content

Commit

Permalink
fix: check if grafana api key is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemental committed Aug 7, 2024
1 parent 67c7062 commit 4c1a85b
Showing 1 changed file with 2 additions and 2 deletions.
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 4c1a85b

Please sign in to comment.