]> git-server-git.apps.pok.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)
committerErnesto Puerta <epuertat@redhat.com>
Fri, 28 Jan 2022 11:48:00 +0000 (12:48 +0100)
Signed-off-by: Pere Diaz Bou <pdiazbou@redhat.com>
(cherry picked from commit a3cf5c5e9fad32753e5263994eaa2754157af92f)

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')