Alejandro Mery
1 year ago
2 changed files with 49 additions and 27 deletions
@ -1,27 +0,0 @@
|
||||
package zones |
||||
|
||||
// PruneWireguardConfig removes wgN.conf files of machines with
|
||||
// the corresponding ring disabled.
|
||||
func (z *Zone) PruneWireguardConfig(ring int) error { |
||||
return pruneWireguardConfig(z, ring) |
||||
} |
||||
|
||||
// PruneWireguardConfig removes wgN.conf files of machines with
|
||||
// the corresponding ring disabled on all zones
|
||||
func (m *Zones) PruneWireguardConfig(ring int) error { |
||||
return pruneWireguardConfig(m, ring) |
||||
} |
||||
|
||||
func pruneWireguardConfig(m MachineIterator, ring int) error { |
||||
var err error |
||||
|
||||
m.ForEachMachine(func(p *Machine) bool { |
||||
_, ok := p.getRingInfo(ring) |
||||
if !ok { |
||||
err = p.RemoveWireguardConfig(ring) |
||||
} |
||||
return err != nil |
||||
}) |
||||
|
||||
return err |
||||
} |
Loading…
Reference in new issue