diff --git a/plugins/modules/grafana_silence.py b/plugins/modules/grafana_silence.py index 5b9a6af9..d995d5cd 100644 --- a/plugins/modules/grafana_silence.py +++ b/plugins/modules/grafana_silence.py @@ -269,20 +269,20 @@ def organization_by_name(self, org_name): ) def get_version(self): - url = "/api/health" - response = self._send_request( - url, data=None, headers=self.headers, method="GET" - ) - version = response.get("version") - if version is not None: - try: - # Split the version by '-' to handle the build number - version_main, build_number = version.split("-") - major, minor, rev = version_main.split(".") - return {"major": int(major), "minor": int(minor), "rev": int(rev), "build": build_number} - except ValueError: - raise GrafanaError(f"Unexpected version format: '{version}'") - raise GrafanaError("Failed to retrieve version from '%s'" % url) + url = "/api/health" + response = self._send_request( + url, data=None, headers=self.headers, method="GET" + ) + version = response.get("version") + if version is not None: + try: + # Split the version by '-' to handle the build number + version_main, build_number = version.split("-") + major, minor, rev = version_main.split(".") + return {"major": int(major), "minor": int(minor), "rev": int(rev), "build": build_number} + except ValueError: + raise GrafanaError(f"Unexpected version format: '{version}'") + raise GrafanaError("Failed to retrieve version from '%s'" % url) def create_silence(self, comment, created_by, starts_at, ends_at, matchers): url = "/api/alertmanager/grafana/api/v2/silences"