Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions openstack/endpoint_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func V2EndpointURL(catalog *tokens2.ServiceCatalog, opts golangsdk.EndpointOpts)
for _, entry := range catalog.Entries {
if (entry.Type == opts.Type) && (opts.Name == "" || entry.Name == opts.Name) {
for _, endpoint := range entry.Endpoints {
if opts.Region == "" || endpoint.Region == opts.Region {
if endpoint.Region == opts.Region || (opts.Region == "" && endpoint.Region == "*") {
endpoints = append(endpoints, endpoint)
}
}
Expand Down Expand Up @@ -83,8 +83,9 @@ func V3EndpointURL(catalog *tokens3.ServiceCatalog, opts golangsdk.EndpointOpts)
err.Value = opts.Availability
return "", err
}
if (opts.Availability == golangsdk.Availability(endpoint.Interface)) &&
(opts.Region == "" || endpoint.Region == opts.Region) {
if opts.Availability == golangsdk.Availability(endpoint.Interface) &&
(endpoint.Region == opts.Region ||
(opts.Region == "" && endpoint.Region == "*")) {
endpoints = append(endpoints, endpoint)
}
}
Expand Down
1 change: 1 addition & 0 deletions openstack/testing/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ func TestIdentityAdminV3Client(t *testing.T) {
pc, err := openstack.AuthenticatedClient(options)
th.AssertNoErr(t, err)
sc, err := openstack.NewIdentityV3(pc, golangsdk.EndpointOpts{
Region: "RegionOne",
Availability: golangsdk.AvailabilityAdmin,
})
th.AssertNoErr(t, err)
Expand Down