Browse Source

state: allow for removal of persistent keepalive

tags/v0.9
Maximilian Eschenbacher 6 years ago
parent
commit
fdd446ce19
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      _states/wireguard.py

+ 4
- 1
_states/wireguard.py View File

@@ -89,10 +89,13 @@ def peer_present(name, interface, endpoint=None, persistent_keepalive=None,
__salt__['wg.set'](interface, peer=name, endpoint=endpoint)
ret['changes']['endpoint'] = 'Endpoint changed.'

if show.get('persistent keepalive', None) != persistent_keepalive:
if persistent_keepalive and show.get('persistent keepalive', None).startswith('every %s second' % (persistent_keepalive,)):
__salt__['wg.set'](interface, peer=name,
persistent_keepalive=persistent_keepalive)
ret['changes']['persistent keepalive'] = 'persistent keepalive changed.'
elif not persistent_keepalive and show.get('persistent keepalive'):
__salt__['wg.set'](interface, peer=name, persistent_keepalive=0)
ret['changes']['persistent keepalive'] = 'persistent keepalive removed.'

ret['result'] = True


Loading…
Cancel
Save