Ver código fonte

states: peer_present: display only if endpoint really changed

master
Maximilian Eschenbacher 6 anos atrás
pai
commit
441bac008d
1 arquivos alterados com 4 adições e 2 exclusões
  1. +4
    -2
      _states/wireguard.py

+ 4
- 2
_states/wireguard.py Ver arquivo

@@ -82,8 +82,10 @@ def peer_present(name, interface, endpoint=None, persistent_keepalive=None,

if endpoint and show.get('endpoint', '') != endpoint:
__salt__['wg.set'](interface, peer=name, endpoint=endpoint)
ret['changes']['endpoint'] = dict(
old=show.get('endpoint'), new=endpoint)
updated_show = __salt__['wg.show'](name=interface, peer=name)
if updated_show.get('endpoint') != show.get('endpoint'):
ret['changes']['endpoint'] = dict(
old=show.get('endpoint'), new=updated_show.get('endpoint'))

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

Carregando…
Cancelar
Salvar