diagnostics: Use new component based API for all diagnostic tests

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2019-12-30 11:37:46 -05:00
1 parent 1f14c42af5
commit 2ebb565c92
43 files changed
+334 -616

No files matched your search

+18 -15
View File
@@ -23,9 +23,10 @@ import subprocess
from django.utils.translation import ugettext_lazy as _
from plinth import action_utils, actions
from plinth import actions
from plinth import app as app_module
from plinth import cfg, menu
from plinth.daemon import Daemon
from plinth.utils import format_lazy
version = 3
@@ -37,6 +38,8 @@ managed_packages = [
'nslcd', 'samba-common-bin', 'slapd', 'tdb-tools'
]
managed_services = ['slapd']
first_boot_steps = [
{
'id': 'users_firstboot',
@@ -79,6 +82,20 @@ class UsersApp(app_module.App):
'users:index', parent_url_name='system')
self.add(menu_item)
daemon = Daemon('daemon-users', managed_services[0],
listen_ports=[(389, 'tcp4'), (389, 'tcp6')])
self.add(daemon)
def diagnose(self):
"""Run diagnostics and return the results."""
results = super().diagnose()
results.append(_diagnose_ldap_entry('dc=thisbox'))
results.append(_diagnose_ldap_entry('ou=people'))
results.append(_diagnose_ldap_entry('ou=groups'))
return results
def init():
"""Initialize the user module."""
@@ -96,20 +113,6 @@ def setup(helper, old_version=None):
create_group('freedombox-share')
def diagnose():
"""Run diagnostics and return the results."""
results = []
results.append(action_utils.diagnose_port_listening(389, 'tcp4'))
results.append(action_utils.diagnose_port_listening(389, 'tcp6'))
results.append(_diagnose_ldap_entry('dc=thisbox'))
results.append(_diagnose_ldap_entry('ou=people'))
results.append(_diagnose_ldap_entry('ou=groups'))
return results
def _diagnose_ldap_entry(search_item):
"""Diagnose that an LDAP entry exists."""
result = 'failed'