Browse Source

env: export ZONE{zoneID}_REGION

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/45/head
Alejandro Mery 10 months ago
parent
commit
fefbfa16a2
  1. 18
      pkg/cluster/env.go

18
pkg/cluster/env.go

@ -94,6 +94,9 @@ func (m *Env) writeEnvZone(w io.Writer, z *Zone) {
gateways, _ := z.GatewayIDs()
m.writeEnvVarInts(w, gateways, "ZONE%v_%s", zoneID, "GW")
// ZONE{zoneID}_REGION
m.writeEnvVar(w, genEnvZoneRegion(z), "ZONE%v_%s", zoneID, "REGION")
// Ceph
monitors := z.GetCephMonitors()
// MON{zoneID}_NAME
@ -166,6 +169,21 @@ func genEnvZoneNodes(z *Zone) string {
return ""
}
func genEnvZoneRegion(z *Zone) string {
var region string
z.ForEachRegion(func(r *Region) bool {
if r.Cluster != nil {
region = r.Name
return true
}
return false
})
return region
}
func genEnvZoneCephMonNames(m Machines) string {
var buf strings.Builder
m.ForEachMachine(func(p *Machine) bool {

Loading…
Cancel
Save