From 14644fb1a8af1e874a29ecdaccdb964a0360374a Mon Sep 17 00:00:00 2001 From: Enrique Vallespi Gil Date: Mon, 15 Dec 2025 12:02:07 +0100 Subject: [PATCH] [pcp_metrics] Skip malformed annotation lines So now we're skipping lines that doesn't match the expected format of: TIMESTAMP | Details So any log line like: " - PLAY [Manage and Provide ironic baremetal nodes] stdout: "[WARNING]: Found variable using reserved name: namespace\n\n" should not be parsed and then not making a runtime Error. Signed-off-by: Enrique Vallespi Gil --- roles/pcp_metrics/files/plot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/roles/pcp_metrics/files/plot.py b/roles/pcp_metrics/files/plot.py index 39cb1780f1..2ee1e5b5f6 100755 --- a/roles/pcp_metrics/files/plot.py +++ b/roles/pcp_metrics/files/plot.py @@ -410,7 +410,11 @@ def annotate(axs: Iterable[plt.Axes]) -> None: data = file.read().strip().split("\n") for annotation in data: - time, details = annotation.split(" | ", maxsplit=1) + try: + time, details = annotation.split(" | ", maxsplit=1) + except ValueError: + print("WARNING Skipping malformed annotation line:", annotation.strip()) + continue time = datetime.strptime(time, "%Y-%m-%d %H:%M:%S,%f") if details.startswith("PLAY"):