Skip to content

Commit

Permalink
chore: fix ruff findings
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemental committed Jan 15, 2024
1 parent 0977c60 commit ff4dc66
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion plugins/modules/grafana_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions plugins/modules/grafana_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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")

Expand Down
4 changes: 0 additions & 4 deletions tests/unit/modules/grafana/grafana_team/test_grafana_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])

Expand Down Expand Up @@ -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:
Expand All @@ -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()

Expand All @@ -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()

Expand Down

0 comments on commit ff4dc66

Please sign in to comment.