]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
monitoring/grafana: use Path class instead of split
authorPere Diaz Bou <pdiazbou@redhat.com>
Mon, 3 Jan 2022 11:52:09 +0000 (12:52 +0100)
committerPere Diaz Bou <pdiazbou@redhat.com>
Tue, 18 Jan 2022 12:24:12 +0000 (13:24 +0100)
Signed-off-by: Pere Diaz Bou <pdiazbou@redhat.com>
monitoring/grafana/dashboards/tests/util.py

index 526f7a73752eedcf5405ba84a0e718dc7556df19..8bc097875d77cd8949f2b94175e0ef91ee8d2bfb 100644 (file)
@@ -56,8 +56,8 @@ def add_dashboard_queries(data: Dict[str, Any], dashboard_data: Dict[str, Any],
                     # NOTE: If two or more panels have the same name and legend it
                     # might suggest a refactoring is needed or add something else
                     # to identify each query.
-                    conflict_file = data['queries'][query_id]['path'].split('/')[-1]
-                    file = path.split('/')[-1]
+                    conflict_file = Path(data['queries'][query_id]['path']).name
+                    file = Path(path).name
                     cprint((f'ERROR: Query in panel "{title}" with legend "{legend_format}"'
                                        f' already exists. Conflict "{conflict_file}" '
                                        f'with: "{file}"'), 'red')