don't use region environment variable
diff --git a/acceptance/openstack/storage_test.go b/acceptance/openstack/storage_test.go
index 0cd3c12..bd12a33 100644
--- a/acceptance/openstack/storage_test.go
+++ b/acceptance/openstack/storage_test.go
@@ -11,6 +11,7 @@
"github.com/rackspace/gophercloud/openstack/storage/v1/containers"
"github.com/rackspace/gophercloud/openstack/storage/v1/objects"
"github.com/rackspace/gophercloud/openstack/utils"
+ "os"
"strings"
"testing"
)
@@ -26,7 +27,8 @@
}
client, err := ao.NewClient(identity.EndpointOpts{
- Type: "object-store",
+ Region: os.Getenv("OS_REGION_NAME"),
+ Type: "object-store",
})
if err != nil {
return nil, err
diff --git a/openstack/identity/v2/client.go b/openstack/identity/v2/client.go
index 921ab7e..ad0413a 100644
--- a/openstack/identity/v2/client.go
+++ b/openstack/identity/v2/client.go
@@ -1,9 +1,5 @@
package identity
-import (
- "os"
-)
-
// Client contains information that defines a generic Openstack Client.
type Client struct {
// Endpoint is the URL against which to authenticate.
@@ -24,8 +20,6 @@
// same Type but different Name, which is one example of when both Type and Name are needed.
Name string
// Region is the region in which the service resides.
- // Region is not a required field. If Region is not set, then the OS_REGION_NAME enviroment
- // variable is used.
Region string
// URLType is they type of endpoint to be returned (e.g., "public", "private").
// URLType is not required, and defaults to "public".
@@ -79,14 +73,9 @@
}
}
- region := os.Getenv("OS_REGION_NAME")
- if opts.Region != "" {
- region = opts.Region
- }
-
var rep string
for _, ep := range eps {
- if ep.Region == region {
+ if ep.Region == opts.Region {
switch opts.URLType {
case "public":
rep = ep.PublicURL