From 7652b8fcb6a57d6e7bf81d9dd54daac5ae07d18d Mon Sep 17 00:00:00 2001 From: Seokho Son Date: Mon, 29 Jul 2024 20:07:07 +0900 Subject: [PATCH] Fix GetRegion info bug --- src/core/common/utility.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/core/common/utility.go b/src/core/common/utility.go index 4736a0f49..acc545ef2 100644 --- a/src/core/common/utility.go +++ b/src/core/common/utility.go @@ -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 } }