zones: Zone.PruneWireguardConfig()

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-08-25 17:38:14 +00:00
parent 1859c8e04b
commit 4ca77b0ac0
+17
View File
@@ -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
}