mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
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:
19 files changed
+284
-183
No files matched your search
@@ -8,6 +8,7 @@ from django.utils.text import format_lazy
|
||||
from django.utils.translation import gettext_lazy
|
||||
|
||||
from plinth import action_utils, app
|
||||
from plinth.modules.diagnostics.check import DiagnosticCheck
|
||||
from plinth.privileged import service as service_privileged
|
||||
|
||||
from . import privileged
|
||||
@@ -145,13 +146,15 @@ def diagnose_url(url, kind=None, env=None, check_certificate=True,
|
||||
wrapper, expected_output)
|
||||
|
||||
if kind:
|
||||
check_id = f'apache-url-{url}-{kind}'
|
||||
template = gettext_lazy('Access URL {url} on tcp{kind}')
|
||||
testname = format_lazy(template, url=url, kind=kind)
|
||||
description = format_lazy(template, url=url, kind=kind)
|
||||
else:
|
||||
check_id = f'apache-url-{url}'
|
||||
template = gettext_lazy('Access URL {url}')
|
||||
testname = format_lazy(template, url=url)
|
||||
description = format_lazy(template, url=url)
|
||||
|
||||
return [testname, result]
|
||||
return DiagnosticCheck(check_id, description, result)
|
||||
|
||||
|
||||
def diagnose_url_on_all(url, expect_redirects=False, **kwargs):
|
||||
|
||||
Reference in new issue
Block a user