From d47f7db70846ea0d08e5040152780dfe8f56a50a Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 23 Sep 2023 15:04:11 +0200 Subject: [PATCH] bundles/wireguard: only try to auto-generate ips and ports if nodes are present in WG_AUTOGEN_NODES --- bundles/wireguard/metadata.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bundles/wireguard/metadata.py b/bundles/wireguard/metadata.py index e2fe76d..9f8e28c 100644 --- a/bundles/wireguard/metadata.py +++ b/bundles/wireguard/metadata.py @@ -91,6 +91,9 @@ def peer_pubkeys(metadata): 'wireguard/peers', ) def peer_ips_and_ports(metadata): + if node.name not in repo.libs.s2s.WG_AUTOGEN_NODES: + raise DoNotRunAgain + peers = {} base_port = 51820 @@ -100,6 +103,9 @@ def peer_ips_and_ports(metadata): except NoSuchNode: continue + if rnode.name not in repo.libs.s2s.WG_AUTOGEN_NODES: + continue + ip_a, ip_b = repo.libs.s2s.get_subnet_for_connection(repo, *sorted({node.name, peer_name})) if peer_name < node.name: