diagnostics: Add DiagnosticCheck dataclass

- Set unique check_id for each diagnostic check.

- Result is a string-based enumeration. The default value (NOT_DONE) can be
  used for diagnostic checks that have not been completed yet.

- Result is StrEnum so that the return value of check_url can still be used
  directly as a diagnostic result.

Closes: #2375

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy committed 2023-10-07 04:52:13 +09:00
1 parent d9491d5762
commit 79f36e6a0c
19 files changed
+284 -183

No files matched your search

+6 -4
View File
@@ -19,6 +19,7 @@ from plinth.modules.apache.components import diagnose_url_on_all
from plinth.modules.backups.components import BackupRestore
from . import manifest
from .check import Result
_description = [
_('The system diagnostic test will run a number of checks on your '
@@ -299,13 +300,14 @@ def _run_background_diagnostics():
for _app_id, app_data in results.items():
if app_data['exception']:
exception_count += 1
continue
for _test, result in app_data['diagnosis']:
if result == 'error':
for check in app_data['diagnosis']:
if check.result == Result.ERROR:
error_count += 1
elif result == 'failed':
elif check.result == Result.FAILED:
failure_count += 1
elif cfg.develop and result == 'warning':
elif check.result == Result.WARNING:
warning_count += 1
notification_id = 'diagnostics-background'