Skip to content

Commit

Permalink
fix: read output of health api if ok
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemental committed Jun 28, 2024
1 parent b7f7746 commit a7e584d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions plugins/modules/grafana_notification_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,11 +650,13 @@ def get_version(self):
headers=self.headers,
method="GET",
)
version = r.get("version")
if version is not None:
major, minor, rev = version.split(".")
return {"major": int(major), "minor": int(minor), "rev": int(rev)}
raise GrafanaAPIException("Failed to retrieve version: %s" % info)
if info["status"] == 200:
version = json.loads(to_text(r.read())).get("version")
if version is not None:
major, minor, rev = version.split(".")
return {"major": int(major), "minor": int(minor), "rev": int(rev)}
else:
raise GrafanaAPIException("Failed to retrieve version: %s" % info)

def grafana_switch_organisation(self, grafana_url, org_id):
r, info = fetch_url(
Expand Down

0 comments on commit a7e584d

Please sign in to comment.