bundles/wireguard: only try to auto-generate ips and ports if nodes are present in WG_AUTOGEN_NODES

This commit is contained in:
Franzi 2023-09-23 15:04:11 +02:00
parent 0d79216ae5
commit d47f7db708
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -91,6 +91,9 @@ def peer_pubkeys(metadata):
'wireguard/peers', 'wireguard/peers',
) )
def peer_ips_and_ports(metadata): def peer_ips_and_ports(metadata):
if node.name not in repo.libs.s2s.WG_AUTOGEN_NODES:
raise DoNotRunAgain
peers = {} peers = {}
base_port = 51820 base_port = 51820
@ -100,6 +103,9 @@ def peer_ips_and_ports(metadata):
except NoSuchNode: except NoSuchNode:
continue 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})) ip_a, ip_b = repo.libs.s2s.get_subnet_for_connection(repo, *sorted({node.name, peer_name}))
if peer_name < node.name: if peer_name < node.name: