diagnostics: Implement diagnostics for Plinth

- Note that while Plinth is running or not running, diagnostics can be
  run on the command line with --diagnose option to Plinth binary.  That
  makes these tests just as useful as freedombox-setup testsuite.
This commit is contained in:
Sunil Mohan Adapa 2015-08-21 20:07:19 +05:30 committed by James Valleroy
parent c2e85a872e
commit 6b7de75b62
2 changed files with 13 additions and 2 deletions

View File

@ -21,7 +21,19 @@ Plinth module for system diagnostics
from . import diagnostics
from .diagnostics import init
from plinth import action_utils
__all__ = ['diagnostics', 'init']
depends = ['plinth.modules.system']
def diagnose():
"""Run diagnostics and return the results."""
results = []
results.append(action_utils.diagnose_port_listening(8000, 'tcp4'))
results.append(action_utils.diagnose_port_listening(8000, 'tcp6'))
results.extend(action_utils.diagnose_url_on_all(
'http://{host}/plinth/', extra_options=['--no-check-certificate']))
return results

View File

@ -25,7 +25,6 @@ from django.conf.urls import patterns, url
urlpatterns = patterns( # pylint: disable-msg=C0103
'plinth.modules.diagnostics.diagnostics',
url(r'^sys/diagnostics/$', 'index', name='index'),
url(r'^sys/diagnostics/test/$', 'test', name='test'),
url(r'^sys/diagnostics/module/(?P<module_name>[a-z\-]+)/$', 'module',
url(r'^sys/diagnostics/(?P<module_name>[a-z\-]+)/$', 'module',
name='module'),
)