Sfoglia il codice sorgente

module: check on set

tags/v0.9
Maximilian Eschenbacher 6 anni fa
parent
commit
705fe1dad4
1 ha cambiato i file con 8 aggiunte e 0 eliminazioni
  1. +8
    -0
      _modules/wireguard.py

+ 8
- 0
_modules/wireguard.py Vedi File

@@ -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…
Annulla
Salva