wireguard: Fix module.app usage that is no longer available

Tests:

- Add a new server and delete it.

- Add a new client and delete it.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2022-08-14 20:18:54 -07:00 committed by James Valleroy
parent f8136e8c8f
commit bd90e59fa3
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -9,7 +9,9 @@ import logging
import subprocess
import time
from plinth import actions, network
from plinth import actions
from plinth import app as app_module
from plinth import network
from plinth.utils import import_from_gi
nm = import_from_gi('NM', '1.0')
@ -156,8 +158,7 @@ def _find_next_interface():
def add_server(settings):
"""Add information for connecting to a server."""
from plinth.modules.wireguard import app
app = app_module.App.get('wireguard')
interface_name = _find_next_interface()
settings['common']['name'] = 'WireGuard-Client-' + interface_name
settings['common']['interface'] = interface_name
@ -182,8 +183,7 @@ def edit_server(interface, settings):
def setup_server():
"""Setup a server connection that clients can connect to."""
from plinth.modules.wireguard import app
app = app_module.App.get('wireguard')
setting_name = nm.SETTING_WIREGUARD_SETTING_NAME
private_key = _generate_private_key()
settings = {