瀏覽代碼

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


Loading…
取消
儲存