瀏覽代碼

state: present: show private keys for comparison

tags/v0.9
Maximilian Eschenbacher 6 年之前
父節點
當前提交
c58f1712a9
共有 1 個檔案被更改,包括 4 行新增4 行删除
  1. +4
    -4
      _states/wireguard.py

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

@@ -13,12 +13,12 @@ def present(name, listen_port=None, fwmark=None, private_key=None):

ret = dict(name=name, changes=dict(), result=False, comment=None)

interface = __salt__['wg.show'](name)
if not interface:
interface = __salt__['wg.create'](name)
show = __salt__['wg.show'](name, hide_keys=False)
if not show:
__salt__['wg.create'](name)
ret['changes'][name] = 'Interface created.'

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

if int(show.get('listening port', 0)) != int(listen_port):
__salt__['wg.set'](name, listen_port=listen_port)

Loading…
取消
儲存