mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +00:00
letsencrypt: Always return a diagnostics result
Return a warning result if no domains are configured. Signed-off-by: James Valleroy <jvalleroy@mailbox.org> Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
parent
26b6bbcb52
commit
c293a01a1f
@ -131,8 +131,8 @@ class App:
|
||||
|
||||
Return value must be a list of results. Each result is a two-tuple with
|
||||
first value as user visible description of the test followed by the
|
||||
result. The test result is a string enumeration from 'failed', 'passed'
|
||||
and 'error'.
|
||||
result. The test result is a string enumeration from 'failed',
|
||||
'passed', 'error' and 'warning'.
|
||||
|
||||
Results are typically collected by diagnosing each component of the app
|
||||
and then supplementing the results with any app level diagnostic tests.
|
||||
|
||||
@ -96,11 +96,12 @@ def run_on_all_enabled_modules():
|
||||
'progress_percentage': 0
|
||||
}
|
||||
|
||||
# Three result strings returned by tests, mark for translation and
|
||||
# Four result strings returned by tests, mark for translation and
|
||||
# translate later.
|
||||
ugettext_noop('passed')
|
||||
ugettext_noop('failed')
|
||||
ugettext_noop('error')
|
||||
ugettext_noop('warning')
|
||||
|
||||
apps = []
|
||||
for app in app_module.App.list():
|
||||
@ -127,17 +128,6 @@ def run_on_all_enabled_modules():
|
||||
'exception': None,
|
||||
}
|
||||
|
||||
try:
|
||||
app_results['diagnosis'] = app.diagnose()
|
||||
except Exception as exception:
|
||||
logger.exception('Error running %s diagnostics - %s', app_id,
|
||||
exception)
|
||||
app_results['exception'] = str(exception)
|
||||
|
||||
current_results['results'][app_id].update(app_results)
|
||||
current_results['progress_percentage'] = \
|
||||
int((current_index + 1) * 100 / len(apps))
|
||||
|
||||
global running_task
|
||||
running_task = None
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<span class="badge badge-success">{% trans result %}</span>
|
||||
{% elif result == 'failed' %}
|
||||
<span class="badge badge-danger">{% trans result %}</span>
|
||||
{% elif result == 'error' %}
|
||||
{% elif result == 'error' or result == 'warning' %}
|
||||
<span class="badge badge-warning">{% trans result %}</span>
|
||||
{% else %}
|
||||
{{ result }}
|
||||
|
||||
@ -91,6 +91,10 @@ class LetsEncryptApp(app_module.App):
|
||||
if domain.domain_type.can_have_certificate:
|
||||
results.append(diagnose_url('https://' + domain.name))
|
||||
|
||||
if not results:
|
||||
results.append(
|
||||
(_('Cannot test: No domains are configured.'), 'warning'))
|
||||
|
||||
return results
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user