소스 검색

module: check on set

tags/v0.9
Maximilian Eschenbacher 6 년 전
부모
커밋
705fe1dad4
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. +8
    -0
      _modules/wireguard.py

+ 8
- 0
_modules/wireguard.py 파일 보기

@@ -59,16 +59,24 @@ def set(name, listen_port=None, fwmark=None, private_key=None, peer=None,
if peer:
s = '%s peer %s' % (s, peer)
if preshared_key:
if not peer:
return 'If preshared_key is given, peer must also be given'
fd2, filename2 = mkstemp(text=True)
with open(filename2, 'w') as f:
f.write(preshared_key)
os.close(fd2)
s = '%s preshared-key %s' % (s, filename2)
if endpoint:
if not peer:
return 'If endpoint is given, peer must also be given'
s = '%s endpoint %s' % (s, endpoint)
if persistent_keepalive:
if not peer:
return 'If persistent_keepalive is given, peer must also be given'
s = '%s persistent-keepalive %s' % (s, persistent_keepalive)
if allowed_ips:
if not peer:
return 'If allowed_ips is given, peer must also be given'
s = '%s allowed-ips %s' % (s, allowed_ips)

r = __salt__['cmd.run'](s)

Loading…
취소
저장