zones: Zone.PruneWireguardConfig()
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user