bundles/wireguard: better dependency management

This commit is contained in:
Franzi 2022-03-10 20:36:20 +01:00
parent 7a8d7b630e
commit e181be3fc6
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -8,6 +8,11 @@ files = {
}, },
} }
deps = set()
if node.has_bundle('apt'):
deps.add('pkg_apt:wireguard')
health_checks = {} health_checks = {}
for number, (peer, config) in enumerate(sorted(node.metadata.get('wireguard/peers', {}).items())): for number, (peer, config) in enumerate(sorted(node.metadata.get('wireguard/peers', {}).items())):
files[f'/etc/systemd/network/wg{number}.netdev'] = { files[f'/etc/systemd/network/wg{number}.netdev'] = {
@ -22,7 +27,7 @@ for number, (peer, config) in enumerate(sorted(node.metadata.get('wireguard/peer
'psk': config['psk'], 'psk': config['psk'],
'pubkey': config['pubkey'], 'pubkey': config['pubkey'],
}, },
'needs': {'pkg_apt:wireguard'} if node.has_bundle('apt') else set(), 'needs': deps,
'triggers': { 'triggers': {
'svc_systemd:systemd-networkd:restart', 'svc_systemd:systemd-networkd:restart',
}, },