From e360e3aaaf47782a260aede5cda53ef0df2f8318 Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Fri, 31 May 2024 11:29:00 +0200 Subject: [PATCH 1/3] fix: remove deprecation check for api_key version --- plugins/lookup/grafana_dashboard.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/plugins/lookup/grafana_dashboard.py b/plugins/lookup/grafana_dashboard.py index 83ee250f..0a1baa43 100644 --- a/plugins/lookup/grafana_dashboard.py +++ b/plugins/lookup/grafana_dashboard.py @@ -152,16 +152,10 @@ def grafana_switch_organisation(self, headers): def grafana_headers(self): headers = {"content-type": "application/json; charset=utf8"} - if self.grafana_api_key: - api_key = self.grafana_api_key - if len(api_key) % 4 == 2: - display.deprecated( - "Passing a mangled version of the API key to the grafana_dashboard lookup is no longer necessary and should not be done.", - "2.0.0", - collection_name="community.grafana", - ) - api_key += "==" - headers["Authorization"] = "Bearer %s" % api_key + if module.params.get("grafana_api_key", None): + self.headers["Authorization"] = ( + "Bearer %s" % module.params["grafana_api_key"] + ) else: headers["Authorization"] = basic_auth_header( self.grafana_user, self.grafana_password From d3ac6e2a4383d82362602cb6e1983d281a28d648 Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Fri, 31 May 2024 11:31:37 +0200 Subject: [PATCH 2/3] docs: changelog fragment --- .../fragments/376-dashboard-lookup-api-key-deprecation.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelogs/fragments/376-dashboard-lookup-api-key-deprecation.yml diff --git a/changelogs/fragments/376-dashboard-lookup-api-key-deprecation.yml b/changelogs/fragments/376-dashboard-lookup-api-key-deprecation.yml new file mode 100644 index 00000000..a462ffd3 --- /dev/null +++ b/changelogs/fragments/376-dashboard-lookup-api-key-deprecation.yml @@ -0,0 +1,3 @@ +--- +removed_features: + - removed check and handling of mangled api key in `grafana_dashboard` lookup From 7dd1f7c8bfa9472d1c0fd20f6c1966919963fc12 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 3/3] 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