浏览代码

state: allow for removal of persistent keepalive

tags/v0.9
Maximilian Eschenbacher 6 年前
父节点
当前提交
fdd446ce19
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. +4
    -1
      _states/wireguard.py

+ 4
- 1
_states/wireguard.py 查看文件

@@ -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


正在加载...
取消
保存