]> 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, 26 Apr 2022 08:50:18 +0000 (10:50 +0200)
Signed-off-by: Pere Diaz Bou <pdiazbou@redhat.com>
monitoring/ceph-mixin/tests_dashboards/util.py

index ce1456c725736fa9d6bc3b9cee4f5662b3f07555..4310eb207f0580cde895e2ae4b4c3dace934f408 100644 (file)
@@ -57,8 +57,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')