Browse Source

zones: Zone.PruneWireguardConfig()

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/1/head
Alejandro Mery 1 year ago
parent
commit
4ca77b0ac0
  1. 17
      pkg/zones/zone_rings.go

17
pkg/zones/zone_rings.go

@ -0,0 +1,17 @@
package zones
// PruneWireguardConfig removes wgN.conf files of machines with
// the corresponding ring disabled.
func (z *Zone) PruneWireguardConfig(ring int) error {
var err error
z.ForEachMachine(func(p *Machine) bool {
_, ok := p.getRingInfo(ring)
if !ok {
err = p.RemoveWireguardConfig(ring)
}
return err != nil
})
return err
}
Loading…
Cancel
Save