From dd9b8fb759555a877241cc1f962136f091c8b349 Mon Sep 17 00:00:00 2001 From: Ioannis Androulidakis Date: Thu, 18 Apr 2024 14:45:32 +0200 Subject: [PATCH] BUG#114707 Handle None diff values when collecting diagnostics We have seen that the debug utility that collects diagnostics via MySQL shell fails with an `AttributeError` when executed in a member of a broken GR cluster. It seems that the problem is more generic, since this error happens when the `dump_diff()` function is invoked with a `diff` object that contains at least one value that equals None. Fix this by adding a check to ensure that the value of every diff value to be left-justified is not None before appending it to the current line. Also, print a descriptive message to inform the user that a None diff value was detected and will be skipped from the current line. Signed-off-by: Ioannis Androulidakis --- python/plugins/debug/collect_diagnostics.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/plugins/debug/collect_diagnostics.py b/python/plugins/debug/collect_diagnostics.py index 679919e7ce..408034f266 100644 --- a/python/plugins/debug/collect_diagnostics.py +++ b/python/plugins/debug/collect_diagnostics.py @@ -341,7 +341,10 @@ def get_column_widths(data): for k, v in diff: line = [k.ljust(column_widths[0])] for i, value in enumerate(v): - line.append(value.ljust(column_widths[1+i])) + if value: + line.append(value.ljust(column_widths[1+i])) + else: + print(f"Detected None diff entry, will not append to line") f.write((" | ".join(line) + "\n").encode("utf-8"))