Browse Source

env: export ZONE{zoneID}_REGION

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/45/head
Alejandro Mery 9 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() gateways, _ := z.GatewayIDs()
m.writeEnvVarInts(w, gateways, "ZONE%v_%s", zoneID, "GW") m.writeEnvVarInts(w, gateways, "ZONE%v_%s", zoneID, "GW")
// ZONE{zoneID}_REGION
m.writeEnvVar(w, genEnvZoneRegion(z), "ZONE%v_%s", zoneID, "REGION")
// Ceph // Ceph
monitors := z.GetCephMonitors() monitors := z.GetCephMonitors()
// MON{zoneID}_NAME // MON{zoneID}_NAME
@ -166,6 +169,21 @@ func genEnvZoneNodes(z *Zone) string {
return "" 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 { func genEnvZoneCephMonNames(m Machines) string {
var buf strings.Builder var buf strings.Builder
m.ForEachMachine(func(p *Machine) bool { m.ForEachMachine(func(p *Machine) bool {

Loading…
Cancel
Save