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']
if not checks:
return {}
if checks:
timer = {
'wg-health-check': {
'command': '/usr/local/bin/wg_health_check',
'when': 'minutely',
},
}
else:
timer = {}
return {
'systemd-timers': {
'timers': {
'wg-health-check': {
'command': '/usr/local/bin/wg_health_check',
'when': 'minutely',
},
},
'timers': timer,
},
'wireguard': {
'health_checks': checks,