mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
Automatic merge from release/2.5.0 -> release/2.6.0
* commit 'ebec65e46fe1e8a4f2393e0a2827dbd5e634b9d2': minor fix fix: find empty endpoints due to invalid duplicate service
This commit is contained in:
+11
-6
@@ -190,14 +190,15 @@ func (catalog KeystoneServiceCatalogV2) getRegions() []string {
|
||||
|
||||
func (catalog KeystoneServiceCatalogV2) getServiceEndpoint(service, region, zone string) (KeystoneEndpointV2, error) {
|
||||
var selected KeystoneEndpointV2
|
||||
var findService bool
|
||||
for i := 0; i < len(catalog); i++ {
|
||||
if service == catalog[i].Type {
|
||||
findService = true
|
||||
if len(catalog[i].Endpoints) == 0 {
|
||||
continue
|
||||
}
|
||||
if len(region) == 0 {
|
||||
if len(catalog[i].Endpoints) >= 1 {
|
||||
selected = catalog[i].Endpoints[0]
|
||||
} else {
|
||||
return selected, fmt.Errorf("No default region")
|
||||
}
|
||||
selected = catalog[i].Endpoints[0]
|
||||
} else {
|
||||
regionEps := make([]KeystoneEndpointV2, 0)
|
||||
zoneEps := make([]KeystoneEndpointV2, 0)
|
||||
@@ -222,7 +223,11 @@ func (catalog KeystoneServiceCatalogV2) getServiceEndpoint(service, region, zone
|
||||
return selected, nil
|
||||
}
|
||||
}
|
||||
return selected, fmt.Errorf("No such service %s", service)
|
||||
if findService {
|
||||
return selected, fmt.Errorf("No default region")
|
||||
} else {
|
||||
return selected, fmt.Errorf("No such service %s", service)
|
||||
}
|
||||
}
|
||||
|
||||
func (catalog KeystoneServiceCatalogV2) GetServiceURL(service, region, zone, endpointType string) (string, error) {
|
||||
|
||||
@@ -271,6 +271,9 @@ func (catalog KeystoneServiceCatalogV3) GetServiceURLs(service, region, zone, en
|
||||
}
|
||||
for i := 0; i < len(catalog); i++ {
|
||||
if service == catalog[i].Type {
|
||||
if len(catalog[i].Endpoints) == 0 {
|
||||
continue
|
||||
}
|
||||
var selected []string
|
||||
regeps := make(map[string][]string)
|
||||
regionzone := ""
|
||||
|
||||
Reference in New Issue
Block a user