From 5e76ab7fcea23b181bacb343f8824eba868aca1d Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Fri, 31 May 2024 11:37:09 +0200 Subject: [PATCH] fix: grafana api key variable ref --- plugins/lookup/grafana_dashboard.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/lookup/grafana_dashboard.py b/plugins/lookup/grafana_dashboard.py index 0a1baa43..514d4fd5 100644 --- a/plugins/lookup/grafana_dashboard.py +++ b/plugins/lookup/grafana_dashboard.py @@ -152,10 +152,8 @@ def grafana_switch_organisation(self, headers): def grafana_headers(self): headers = {"content-type": "application/json; charset=utf8"} - if module.params.get("grafana_api_key", None): - self.headers["Authorization"] = ( - "Bearer %s" % module.params["grafana_api_key"] - ) + if self.grafana_api_key.get("grafana_api_key", None): + headers["Authorization"] = "Bearer %s" % self.grafana_api_key else: headers["Authorization"] = basic_auth_header( self.grafana_user, self.grafana_password