From 3b6985744903ea3a3b5934735a87b82d0c6fe542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Malmstr=C3=B6m?= Date: Tue, 19 Nov 2024 13:05:39 +0100 Subject: [PATCH] Update wireguard.py --- modules/wireguard.py | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/modules/wireguard.py b/modules/wireguard.py index 55781fcd..f52e5977 100644 --- a/modules/wireguard.py +++ b/modules/wireguard.py @@ -13,37 +13,11 @@ def generate(host, *args): current_event = lib.get_current_event() - if os.path.isfile(DB_FILE): - try: - conn = sqlite3.connect(DB_FILE) - db = conn.cursor() - except sqlite3.Error as e: - print("An error occurred:", e.args[0]) - sys.exit(2) - else: - print("No database file found: %s" % DB_FILE) - sys.exit(3) - db.execute('SELECT ipv4_netmask_dec FROM network WHERE short_name = "TECH-WIREGUARD-VPN";') - res = db.fetchone() - if not res: - raise NodeNotFoundError('Node %s not found' % host) - - subnet = res[0] - - db.execute('SELECT ipv4_gateway_txt FROM network WHERE short_name = "TECH-WIREGUARD-VPN";') - res = db.fetchone() - conn.close() - if not res: - raise NodeNotFoundError('Node %s not found' % host) - - gatewayIP = res[0] - tunnelIP = ipaddress.ip_address(gatewayIP) + 4 - tunnelIP = str(tunnelIP) info = {} info['current_event'] = current_event - info['tunnelIP'] = tunnelIP + #info['tunnelIP'] = tunnelIP return {'wireguard': info} # vim: ts=4: sts=4: sw=4: expandtab