From 97833a6a81fed7f868e1d544816cfbdf254fdb43 Mon Sep 17 00:00:00 2001 From: Laura Flores Date: Wed, 28 Sep 2022 17:17:17 +0000 Subject: [PATCH] mgr/telemetry: handle daemons with complex ids Treating daemons as `.x` caused a crash in the Telemetry module since the current method does not cover a case where a daemon id is more complex, i.e. `.x.y`. When we parse the daemon type and daemon id, we should split it into a maximum of two pieces rather than splitting it by every `.` character. Specifying `1` in the Python .split() function will limit the split to a maximum of two items. Fixes: https://tracker.ceph.com/issues/57700 Signed-off-by: Laura Flores --- src/pybind/mgr/telemetry/module.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/telemetry/module.py b/src/pybind/mgr/telemetry/module.py index 779cd529b32..f3d49055a5e 100644 --- a/src/pybind/mgr/telemetry/module.py +++ b/src/pybind/mgr/telemetry/module.py @@ -493,7 +493,7 @@ class Module(MgrModule): # Grab output from the "daemon.x heap stats" command for daemon in daemons: - daemon_type, daemon_id = daemon.split('.') + daemon_type, daemon_id = daemon.split('.', 1) heap_stats = self.parse_heap_stats(daemon_type, daemon_id) if heap_stats: if (daemon_type != 'osd'): @@ -568,7 +568,7 @@ class Module(MgrModule): # Grab output from the "dump_mempools" command for daemon in daemons: - daemon_type, daemon_id = daemon.split('.') + daemon_type, daemon_id = daemon.split('.', 1) cmd_dict = { 'prefix': 'dump_mempools', 'format': 'json' -- 2.39.5