bundles/wireguard: fix KeyError when running with no peers
This commit is contained in:
parent
799cff884b
commit
0d79216ae5
1 changed files with 10 additions and 8 deletions
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue