bundles/wireguard: fix KeyError when running with no peers

This commit is contained in:
Franzi 2023-09-23 15:03:44 +02:00
parent 799cff884b
commit 0d79216ae5
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -262,17 +262,19 @@ def health_checks(metadata):
checks[peer] = config['their_ip'] checks[peer] = config['their_ip']
if not checks: if checks:
return {} timer = {
return {
'systemd-timers': {
'timers': {
'wg-health-check': { 'wg-health-check': {
'command': '/usr/local/bin/wg_health_check', 'command': '/usr/local/bin/wg_health_check',
'when': 'minutely', 'when': 'minutely',
}, },
}, }
else:
timer = {}
return {
'systemd-timers': {
'timers': timer,
}, },
'wireguard': { 'wireguard': {
'health_checks': checks, 'health_checks': checks,