From d507d447dd2a64022a12a16e28de00e8036b82f2 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 5 Aug 2019 18:24:12 +0200 Subject: [PATCH] Don't miserably fail if we can't load detail for a log entry --- src/yunohost/log.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/yunohost/log.py b/src/yunohost/log.py index bfbc52aa6..0995dcc83 100644 --- a/src/yunohost/log.py +++ b/src/yunohost/log.py @@ -103,7 +103,12 @@ def log_list(category=[], limit=None, with_details=False): entry["started_at"] = log_datetime if with_details: - metadata = read_yaml(md_path) + try: + metadata = read_yaml(md_path) + except Exception as e: + # If we can't read the yaml for some reason, report an error and ignore this entry... + logger.error(m18n.n('log_corrupted_md_file', md_file=md_path, error=e)) + continue entry["success"] = metadata.get("success", "?") if metadata else "?" result[category].append(entry)