From 14db28776669037ec62bb3d08cc2c06c39753418 Mon Sep 17 00:00:00 2001 From: KiekerJan Date: Wed, 3 Jan 2024 18:02:34 +0100 Subject: [PATCH 1/2] make reading of previous status check result more robust --- management/status_checks.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/management/status_checks.py b/management/status_checks.py index 07e7dc1d..897efff5 100755 --- a/management/status_checks.py +++ b/management/status_checks.py @@ -965,7 +965,11 @@ def run_and_output_changes(env, pool): cache_fn = "/var/cache/mailinabox/status_checks.json" if os.path.exists(cache_fn): with open(cache_fn, 'r') as f: - prev = json.load(f) + try: + prev = json.load(f) + except json.JSONDecodeError: + logging.debug('Could not decode previous status checks JSON file') + prev = [] # Group the serial output into categories by the headings. def group_by_heading(lines): From a2545522c60b3e4783df8a6955c8807efdcf2a11 Mon Sep 17 00:00:00 2001 From: KiekerJan Date: Wed, 10 Jan 2024 20:05:13 +0100 Subject: [PATCH 2/2] remove logging reference --- management/status_checks.py | 1 - 1 file changed, 1 deletion(-) diff --git a/management/status_checks.py b/management/status_checks.py index 897efff5..e8faf6fb 100755 --- a/management/status_checks.py +++ b/management/status_checks.py @@ -968,7 +968,6 @@ def run_and_output_changes(env, pool): try: prev = json.load(f) except json.JSONDecodeError: - logging.debug('Could not decode previous status checks JSON file') prev = [] # Group the serial output into categories by the headings.