]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/ci/check_grafana_dashboards.py
import quincy beta 17.1.0
[ceph.git] / ceph / src / pybind / mgr / dashboard / ci / check_grafana_dashboards.py
index 47e553c84e585fb82a28e20180ec83710f517083..d37337b404ed4c38f6463798c8d64bfb48b4d111 100644 (file)
@@ -10,7 +10,7 @@ Usage:
 
 e.g.
     cd /ceph/src/pybind/mgr/dashboard
-    python ci/<script> frontend/src/app /ceph/monitoring/grafana/dashboards
+    python ci/<script> frontend/src/app /ceph/monitoring/ceph-mixin/dashboards_out
 """
 import argparse
 import codecs
@@ -76,6 +76,22 @@ def get_grafana_dashboards(base_dir):
             with open(json_file) as f:
                 dashboard_config = json.load(f)
                 uid = dashboard_config.get('uid')
+                # if it's not a grafana dashboard, skip checks
+                # Fields in a dasbhoard:
+                # https://grafana.com/docs/grafana/latest/dashboards/json-model/#json-fields
+                expected_fields = [
+                    'id', 'uid', 'title', 'tags', 'style', 'timezone', 'editable',
+                    'hideControls', 'graphTooltip', 'panels', 'time', 'timepicker',
+                    'templating', 'annotations', 'refresh', 'schemaVersion', 'version', 'links',
+                ]
+                not_a_dashboard = False
+                for field in expected_fields:
+                    if field not in dashboard_config:
+                        not_a_dashboard = True
+                        break
+                if not_a_dashboard:
+                    continue
+
                 assert dashboard_config['id'] is None, \
                     "'id' not null: '{}'".format(dashboard_config['id'])