mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
networks: Use new setup mechanism
This commit is contained in:
parent
0568bf259c
commit
335eeccee9
@ -19,23 +19,37 @@
|
||||
Plinth module to interface with network-manager
|
||||
"""
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from logging import Logger
|
||||
import subprocess
|
||||
|
||||
from . import networks
|
||||
from .networks import init
|
||||
from plinth import action_utils
|
||||
from plinth import cfg
|
||||
from plinth import network
|
||||
|
||||
|
||||
__all__ = ['networks', 'init']
|
||||
version = 1
|
||||
|
||||
is_essential = True
|
||||
|
||||
depends = ['system']
|
||||
|
||||
title = _('Networks')
|
||||
|
||||
logger = Logger(__name__)
|
||||
|
||||
|
||||
def init():
|
||||
"""Initialize the Networks module."""
|
||||
menu = cfg.main_menu.get('system:index')
|
||||
menu.add_urlname(title, 'glyphicon-signal', 'networks:index', 18)
|
||||
|
||||
|
||||
def setup(helper, old_version=None):
|
||||
"""Install and configure the module."""
|
||||
helper.install(['network-manager'])
|
||||
|
||||
|
||||
def diagnose():
|
||||
"""Run diagnostics and return the results."""
|
||||
results = []
|
||||
@ -44,8 +58,10 @@ def diagnose():
|
||||
addresses = _get_interface_addresses(interfaces)
|
||||
|
||||
for address in addresses:
|
||||
results.append(action_utils.diagnose_port_listening(53, 'tcp', address))
|
||||
results.append(action_utils.diagnose_port_listening(53, 'udp', address))
|
||||
results.append(
|
||||
action_utils.diagnose_port_listening(53, 'tcp', address))
|
||||
results.append(
|
||||
action_utils.diagnose_port_listening(53, 'udp', address))
|
||||
|
||||
results.append(_diagnose_dnssec('4'))
|
||||
results.append(_diagnose_dnssec('6'))
|
||||
|
||||
@ -25,9 +25,7 @@ from logging import Logger
|
||||
|
||||
from .forms import (ConnectionTypeSelectForm, EthernetForm, PPPoEForm,
|
||||
WifiForm)
|
||||
from plinth import cfg
|
||||
from plinth import network
|
||||
from plinth import package
|
||||
|
||||
|
||||
logger = Logger(__name__)
|
||||
@ -40,14 +38,6 @@ subsubmenu = [{'url': reverse_lazy('networks:index'),
|
||||
'text': ugettext_lazy('Add Connection')}]
|
||||
|
||||
|
||||
def init():
|
||||
"""Initialize the Networks module."""
|
||||
menu = cfg.main_menu.get('system:index')
|
||||
menu.add_urlname(ugettext_lazy('Networks'), 'glyphicon-signal',
|
||||
'networks:index', 18)
|
||||
|
||||
|
||||
@package.required(['network-manager'])
|
||||
def index(request):
|
||||
"""Show connection list."""
|
||||
connections = network.get_connection_list()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user