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']
|
||||
|
||||
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,
|
||||
|
|
Loading…
Reference in a new issue