diff --git a/plugins/modules/grafana_dashboard.py b/plugins/modules/grafana_dashboard.py index d8075252..18ab041b 100644 --- a/plugins/modules/grafana_dashboard.py +++ b/plugins/modules/grafana_dashboard.py @@ -221,7 +221,7 @@ def get_grafana_version(module, grafana_url, headers): try: settings = json.loads(to_text(r.read())) grafana_version = settings["buildInfo"]["version"].split(".")[0] - except UnicodeError as e: + except UnicodeError: raise GrafanaAPIException("Unable to decode version string to Unicode") except Exception as e: raise GrafanaAPIException(e) diff --git a/plugins/modules/grafana_datasource.py b/plugins/modules/grafana_datasource.py index b33acc7e..be631836 100644 --- a/plugins/modules/grafana_datasource.py +++ b/plugins/modules/grafana_datasource.py @@ -736,7 +736,7 @@ def _send_request(self, url, data=None, headers=None, method="GET"): def switch_organization(self, org_id): url = "/api/user/using/%d" % org_id - response = self._send_request(url, headers=self.headers, method="POST") + self._send_request(url, headers=self.headers, method="POST") def organization_by_name(self, org_name): url = "/api/user/orgs" @@ -750,8 +750,6 @@ def organization_by_name(self, org_name): ) def datasource_by_name(self, name): - datasource_exists = False - ds = {} url = "/api/datasources/name/%s" % quote(name, safe="") return self._send_request(url, headers=self.headers, method="GET") diff --git a/tests/unit/modules/grafana/grafana_team/test_grafana_team.py b/tests/unit/modules/grafana/grafana_team/test_grafana_team.py index 523bdaef..ef86961b 100644 --- a/tests/unit/modules/grafana/grafana_team/test_grafana_team.py +++ b/tests/unit/modules/grafana/grafana_team/test_grafana_team.py @@ -149,7 +149,6 @@ def test_module_setup_fails_without_params(self): with self.assertRaises(AnsibleFailJson) as result: grafana_team.main() err, arg_list = result.exception.args[0]["msg"].split(":") - missing_args = [item.strip() for item in arg_list.split(",")] self.assertEqual(err, "missing required arguments") self.assertEqual(arg_list, ["name", "email", "url"]) @@ -219,7 +218,6 @@ def test_module_fails_with_low_grafana_version(self, mock_get_version): } ) - module = grafana_team.setup_module_object() mock_get_version.return_value = get_low_version_resp() with self.assertRaises(AnsibleFailJson) as result: @@ -245,7 +243,6 @@ def test_module_failure_with_unauthorized_resp( "url": "http://grafana.example.com", } ) - module = grafana_team.setup_module_object() mock_fetch_url.return_value = unauthorized_resp() mock_get_version.return_value = get_version_resp() @@ -271,7 +268,6 @@ def test_module_failure_with_permission_denied_resp( "url": "http://grafana.example.com", } ) - module = grafana_team.setup_module_object() mock_fetch_url.return_value = permission_denied_resp() mock_get_version.return_value = get_version_resp()