bundles/wireguard: name wg interfaces according to their peers

This commit is contained in:
Franzi 2023-09-09 13:54:27 +02:00
parent 7b8740601f
commit 7df6b1d13a
Signed by: kunsi
GPG key ID: 12E3D2136B818350
4 changed files with 20 additions and 20 deletions

View file

@ -62,7 +62,8 @@ def neighbor_info_from_wireguard(metadata):
)
def my_ip(metadata):
if node.has_bundle('wireguard'):
my_ip = sorted(metadata.get('interfaces/wg0/ips'))[0].split('/')[0]
wg_iface = sorted({iface for iface in metadata.get('interfaces').keys() if iface.startswith('wg_')})[0]
my_ip = sorted(metadata.get(f'interfaces/{wg_iface}/ips'))[0].split('/')[0]
else:
my_ip = str(sorted(repo.libs.tools.resolve_identifier(repo, node.name))[0])