Skip to content

Commit

Permalink
Fix GetRegion info bug
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-github-robot authored Jul 30, 2024
2 parents 3ab28b7 + 7652b8f commit 28d86a7
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/core/common/utility.go
Original file line number Diff line number Diff line change
Expand Up @@ -1020,17 +1020,13 @@ func GetRegion(ProviderName, RegionName string) (RegionDetail, error) {
return RegionDetail{}, fmt.Errorf("cloudType '%s' not found", ProviderName)
}

// using map directly is not working because of the prefix
// need to be used after we deprecate zone description in test scripts
// directly getting value from the map is disabled because of some possible case mismatches (enhancement needed)
// regionDetail, ok := cspDetail.Regions[nativeRegion]
// if !ok {
// return nativeRegion, RegionDetail{}, fmt.Errorf("nativeRegion '%s' not found in cloudType '%s'", nativeRegion, cloudType)
// RegionDetail{}, fmt.Errorf("nativeRegion '%s' not found in Provider '%s'", RegionName, ProviderName)
// }

// return nativeRegion, regionDetail, nil

for key, regionDetail := range cspDetail.Regions {
if strings.HasPrefix(RegionName, key) {
if strings.EqualFold(RegionName, key) {
return regionDetail, nil
}
}
Expand Down

0 comments on commit 28d86a7

Please sign in to comment.