From: Yaarit Hatuka Date: Thu, 16 Dec 2021 02:53:04 +0000 (+0000) Subject: mgr/telemetry: check that backtrace is not empty when redacting X-Git-Tag: v17.1.0~196^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8f126ca1ac9b0d3b016595286c1f7d07c0a16bfa;p=ceph-ci.git mgr/telemetry: check that backtrace is not empty when redacting Some python crashes contain empty backtraces; check before redacting their final line. Fixes: https://tracker.ceph.com/issues/53604 Signed-off-by: Yaarit Hatuka --- diff --git a/src/pybind/mgr/telemetry/module.py b/src/pybind/mgr/telemetry/module.py index 1346a7511e9..3ff50d650df 100644 --- a/src/pybind/mgr/telemetry/module.py +++ b/src/pybind/mgr/telemetry/module.py @@ -483,8 +483,10 @@ class Module(MgrModule): # redact final line of python tracebacks, as the exception # payload may contain identifying information - if 'mgr_module' in c: - c['backtrace'][-1] = '' + if 'mgr_module' in c and 'backtrace' in c: + # backtrace might be empty + if len(c['backtrace']) > 0: + c['backtrace'][-1] = '' crashlist.append(c) return crashlist