b9e98ca322
Signed-off-by: Alejandro Mery <amery@jpi.io>
18 lines
351 B
Go
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
|
|
}
|