From 71a1d1a7c2c0dfc5dc36e8136ffd316a34a0d1e5 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Sun, 27 Aug 2023 16:45:54 +0000 Subject: [PATCH] zones: Env: allow multiple gateways on a Zone Signed-off-by: Alejandro Mery --- pkg/zones/env.go | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/pkg/zones/env.go b/pkg/zones/env.go index c70698a..a1da645 100644 --- a/pkg/zones/env.go +++ b/pkg/zones/env.go @@ -57,10 +57,8 @@ func (m *Env) writeEnvZone(w io.Writer, z *Zone) { m.writeEnvVar(w, z.Name, "ZONE%v_%s", zoneID, "NAME") // ZONE{zoneID}_GW - gatewayID := getRingZeroGatewayID(z) - if gatewayID > 0 { - m.writeEnvVar(w, fmt.Sprintf("%v", gatewayID), "ZONE%v_%s", zoneID, "GW") - } + gateways, _ := z.GatewayIDs() + m.writeEnvVarInts(w, gateways, "ZONE%v_%s", zoneID, "GW") } func (m *Env) writeEnvVarInts(w io.Writer, value []int, name string, args ...any) { @@ -113,17 +111,3 @@ func genEnvZoneNodes(z *Zone) string { } return "" } - -func getRingZeroGatewayID(z *Zone) int { - var gatewayID int - - z.ForEachMachine(func(p *Machine) bool { - if p.IsGateway() { - gatewayID = p.ID - } - - return gatewayID != 0 - }) - - return gatewayID -}