Files
jpictl/pkg/zones/zone_rings.go
T
amery b9e98ca322 zones: Zone.PruneWireguardConfig()
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-08-25 17:41:04 +00:00

18 lines
351 B
Go

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
}