cluster: fix regions/zones mapping when the region exists

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-10-30 00:17:24 +00:00
parent a910bba406
commit 0094450ca8
+5 -3
View File
@@ -68,7 +68,7 @@ func (m *Cluster) initRegions(_ *ScanOptions) error {
// bind first level regions and their zones
for name, zones := range regions {
m.syncRegions(name, zones...)
m.setRegionZones(name, zones...)
}
// and combine zones to produce larger regions
@@ -81,8 +81,10 @@ func (m *Cluster) initRegions(_ *ScanOptions) error {
return nil
}
func (m *Cluster) syncRegions(name string, zones ...*Zone) {
for _, r := range m.Regions {
func (m *Cluster) setRegionZones(name string, zones ...*Zone) {
for i := range m.Regions {
r := &m.Regions[i]
if r.Name == name {
// found
r.m = m