From 311ae572da3eb93228a12bb6baed06a2923aa6df Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Fri, 25 Aug 2023 20:20:59 +0000 Subject: [PATCH] zones: Zones.PruneWireguardConfig() Signed-off-by: Alejandro Mery --- pkg/zones/zone_rings.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/zones/zone_rings.go b/pkg/zones/zone_rings.go index 8eff196..bde3b7a 100644 --- a/pkg/zones/zone_rings.go +++ b/pkg/zones/zone_rings.go @@ -15,3 +15,16 @@ func (z *Zone) PruneWireguardConfig(ring int) error { return err } + +// PruneWireguardConfig removes wgN.conf files of machines with +// the corresponding ring disabled on all zones +func (m *Zones) PruneWireguardConfig(ring int) error { + var err error + + m.ForEachZone(func(z *Zone) bool { + err = z.PruneWireguardConfig(ring) + return err != nil + }) + + return err +}