Selaa lähdekoodia

modules: set: really remove persistent keepalive

master
Maximilian Eschenbacher 6 vuotta sitten
vanhempi
commit
6c465b38f7
2 muutettua tiedostoa jossa 3 lisäystä ja 3 poistoa
  1. +1
    -1
      _modules/wireguard.py
  2. +2
    -2
      _states/wireguard.py

+ 1
- 1
_modules/wireguard.py Näytä tiedosto

@@ -77,7 +77,7 @@ def set(name, listen_port=None, fwmark=None, private_key=None, peer=None,
if not peer:
return 'If endpoint is given, peer must also be given'
s = '%s endpoint %s' % (s, endpoint)
if persistent_keepalive:
if persistent_keepalive is not None:
if not peer:
return 'If persistent_keepalive is given, peer must also be given'
s = '%s persistent-keepalive %s' % (s, persistent_keepalive)

+ 2
- 2
_states/wireguard.py Näytä tiedosto

@@ -20,7 +20,7 @@ def present(name, listen_port=None, fwmark=None, private_key=None):

show = __salt__['wg.show'](name, hide_keys=False)

if int(show.get('listening port', 0)) != int(listen_port):
if listen_port and int(show.get('listening port', 0)) != int(listen_port):
__salt__['wg.set'](name, listen_port=listen_port)
ret['changes']['listening port'] = dict(
old=show.get('listening port', 0),
@@ -85,7 +85,7 @@ def peer_present(name, interface, endpoint=None, persistent_keepalive=None,
ret['changes']['endpoint'] = dict(
old=show.get('endpoint'), new=endpoint)

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

Loading…
Peruuta
Tallenna