Selaa lähdekoodia

module: check on set

tags/v0.9
Maximilian Eschenbacher 6 vuotta sitten
vanhempi
commit
705fe1dad4
1 muutettua tiedostoa jossa 8 lisäystä ja 0 poistoa
  1. +8
    -0
      _modules/wireguard.py

+ 8
- 0
_modules/wireguard.py Näytä tiedosto

if peer: if peer:
s = '%s peer %s' % (s, peer) s = '%s peer %s' % (s, peer)
if preshared_key: if preshared_key:
if not peer:
return 'If preshared_key is given, peer must also be given'
fd2, filename2 = mkstemp(text=True) fd2, filename2 = mkstemp(text=True)
with open(filename2, 'w') as f: with open(filename2, 'w') as f:
f.write(preshared_key) f.write(preshared_key)
os.close(fd2) os.close(fd2)
s = '%s preshared-key %s' % (s, filename2) s = '%s preshared-key %s' % (s, filename2)
if endpoint: if endpoint:
if not peer:
return 'If endpoint is given, peer must also be given'
s = '%s endpoint %s' % (s, endpoint) s = '%s endpoint %s' % (s, endpoint)
if persistent_keepalive: 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) s = '%s persistent-keepalive %s' % (s, persistent_keepalive)
if allowed_ips: 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) s = '%s allowed-ips %s' % (s, allowed_ips)


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

Loading…
Peruuta
Tallenna