diff --git a/plinth/app.py b/plinth/app.py index c3d388c44..08ed15ade 100644 --- a/plinth/app.py +++ b/plinth/app.py @@ -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. diff --git a/plinth/modules/diagnostics/__init__.py b/plinth/modules/diagnostics/__init__.py index 232c5c6d7..bbf89c2c8 100644 --- a/plinth/modules/diagnostics/__init__.py +++ b/plinth/modules/diagnostics/__init__.py @@ -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 diff --git a/plinth/modules/diagnostics/templates/diagnostics_results.html b/plinth/modules/diagnostics/templates/diagnostics_results.html index 488341014..a46019469 100644 --- a/plinth/modules/diagnostics/templates/diagnostics_results.html +++ b/plinth/modules/diagnostics/templates/diagnostics_results.html @@ -21,7 +21,7 @@ {% trans result %} {% elif result == 'failed' %} {% trans result %} - {% elif result == 'error' %} + {% elif result == 'error' or result == 'warning' %} {% trans result %} {% else %} {{ result }} diff --git a/plinth/modules/letsencrypt/__init__.py b/plinth/modules/letsencrypt/__init__.py index fc66f3fe8..52f259531 100644 --- a/plinth/modules/letsencrypt/__init__.py +++ b/plinth/modules/letsencrypt/__init__.py @@ -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