Openstack client tests now pass again.
diff --git a/openstack/client.go b/openstack/client.go
index c5fd16f..7b17a1c 100644
--- a/openstack/client.go
+++ b/openstack/client.go
@@ -99,7 +99,7 @@
v2Client.Endpoint = endpoint
}
- result := tokens2.Create(v2client, options)
+ result := tokens2.Create(v2Client, options)
token, err := result.ExtractToken()
if err != nil {
@@ -119,20 +119,10 @@
return nil
}
-func v2endpointLocator(catalog tokens2.ServiceCatalog, opts gophercloud.EndpointOpts) (string, error) {
- catalog, err := identity2.GetServiceCatalog(authResults)
- if err != nil {
- return "", err
- }
-
- entries, err := catalog.CatalogEntries()
- if err != nil {
- return "", err
- }
-
+func v2endpointLocator(catalog *tokens2.ServiceCatalog, opts gophercloud.EndpointOpts) (string, error) {
// Extract Endpoints from the catalog entries that match the requested Type, Name if provided, and Region if provided.
- var endpoints = make([]identity2.Endpoint, 0, 1)
- for _, entry := range entries {
+ var endpoints = make([]tokens2.Endpoint, 0, 1)
+ 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 {
@@ -157,6 +147,8 @@
return normalizeURL(endpoint.PublicURL), nil
case gophercloud.AvailabilityInternal:
return normalizeURL(endpoint.InternalURL), nil
+ case gophercloud.AvailabilityAdmin:
+ return normalizeURL(endpoint.AdminURL), nil
default:
return "", fmt.Errorf("Unexpected availability in endpoint query: %s", opts.Availability)
}
diff --git a/openstack/client_test.go b/openstack/client_test.go
index dd39e77..7a350d0 100644
--- a/openstack/client_test.go
+++ b/openstack/client_test.go
@@ -93,12 +93,12 @@
})
testhelper.Mux.HandleFunc("/v2.0/tokens", func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusCreated)
fmt.Fprintf(w, `
{
"access": {
"token": {
- "id": "01234567890"
+ "id": "01234567890",
+ "expires": "2014-10-01T10:00:00.000000Z"
},
"serviceCatalog": [
{