]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/controllers/prometheus.py
import ceph quincy 17.2.4
[ceph.git] / ceph / src / pybind / mgr / dashboard / controllers / prometheus.py
index f1dae7f1a2fa2d89b9b3e3e8176ab939343e7a69..af90f0d60088866045729debcedda8afa2239a24 100644 (file)
@@ -51,7 +51,12 @@ class PrometheusRESTController(RESTController):
                 "Could not reach {}'s API on {}".format(api_name, base_url),
                 http_status_code=404,
                 component='prometheus')
-        content = json.loads(response.content)
+        try:
+            content = json.loads(response.content, strict=False)
+        except json.JSONDecodeError as e:
+            raise DashboardException(
+                "Error parsing Prometheus Alertmanager response: {}".format(e.msg),
+                component='prometheus')
         if content['status'] == 'success':
             if 'data' in content:
                 return content['data']