diff --git a/vendor/github.com/rackspace/gophercloud/openstack/auth_env.go b/vendor/github.com/rackspace/gophercloud/openstack/auth_env.go index a4402b6f0..2d226d609 100644 --- a/vendor/github.com/rackspace/gophercloud/openstack/auth_env.go +++ b/vendor/github.com/rackspace/gophercloud/openstack/auth_env.go @@ -13,14 +13,15 @@ var nilOptions = gophercloud.AuthOptions{} // environment variables, respectively, remain undefined. See the AuthOptions() function for more details. var ( ErrNoAuthURL = fmt.Errorf("Environment variable OS_AUTH_URL needs to be set.") - ErrNoUsername = fmt.Errorf("Environment variable OS_USERNAME needs to be set.") - ErrNoPassword = fmt.Errorf("Environment variable OS_PASSWORD needs to be set.") + ErrNoUsername = fmt.Errorf("Environment variable OS_USERNAME, OS_USERID, or OS_TOKEN needs to be set.") + ErrNoPassword = fmt.Errorf("Environment variable OS_PASSWORD or OS_TOKEN needs to be set.") ) -// AuthOptions fills out an identity.AuthOptions structure with the settings found on the various OpenStack -// OS_* environment variables. The following variables provide sources of truth: OS_AUTH_URL, OS_USERNAME, -// OS_PASSWORD, OS_TENANT_ID, and OS_TENANT_NAME. Of these, OS_USERNAME, OS_PASSWORD, and OS_AUTH_URL must -// have settings, or an error will result. OS_TENANT_ID and OS_TENANT_NAME are optional. +// AuthOptionsFromEnv fills out an AuthOptions structure from the environment +// variables: OS_AUTH_URL, OS_USERNAME, OS_USERID, OS_PASSWORD, OS_TENANT_ID, +// OS_TENANT_NAME, OS_DOMAIN_ID, OS_DOMAIN_NAME, OS_TOKEN. It checks that +// (1) OS_AUTH_URL is set, (2) OS_USERNAME, OS_USERID, or OS_TOKEN is set, +// (3) OS_PASSWORD or OS_TOKEN is set. func AuthOptionsFromEnv() (gophercloud.AuthOptions, error) { authURL := os.Getenv("OS_AUTH_URL") username := os.Getenv("OS_USERNAME") @@ -30,16 +31,17 @@ func AuthOptionsFromEnv() (gophercloud.AuthOptions, error) { tenantName := os.Getenv("OS_TENANT_NAME") domainID := os.Getenv("OS_DOMAIN_ID") domainName := os.Getenv("OS_DOMAIN_NAME") + tokenID := os.Getenv("OS_TOKEN") if authURL == "" { return nilOptions, ErrNoAuthURL } - if username == "" && userID == "" { + if username == "" && userID == "" && tokenID == "" { return nilOptions, ErrNoUsername } - if password == "" { + if password == "" && tokenID == "" { return nilOptions, ErrNoPassword } @@ -52,6 +54,7 @@ func AuthOptionsFromEnv() (gophercloud.AuthOptions, error) { TenantName: tenantName, DomainID: domainID, DomainName: domainName, + TokenID: tokenID, } return ao, nil diff --git a/vendor/github.com/rackspace/gophercloud/openstack/client.go b/vendor/github.com/rackspace/gophercloud/openstack/client.go index 0585211c7..fbb76ead0 100644 --- a/vendor/github.com/rackspace/gophercloud/openstack/client.go +++ b/vendor/github.com/rackspace/gophercloud/openstack/client.go @@ -3,6 +3,7 @@ package openstack import ( "fmt" "net/url" + "strconv" "strings" "github.com/rackspace/gophercloud" @@ -25,18 +26,40 @@ func NewClient(endpoint string) (*gophercloud.ProviderClient, error) { if err != nil { return nil, err } - hadPath := u.Path != "" - u.Path, u.RawQuery, u.Fragment = "", "", "" - base := u.String() + u.RawQuery, u.Fragment = "", "" + + // Base is url with path endpoint = gophercloud.NormalizeURL(endpoint) - base = gophercloud.NormalizeURL(base) + base := gophercloud.NormalizeURL(u.String()) - if hadPath { - return &gophercloud.ProviderClient{ - IdentityBase: base, - IdentityEndpoint: endpoint, - }, nil + path := u.Path + if !strings.HasSuffix(path, "/") { + path = path + "/" + } + + parts := strings.Split(path[0:len(path)-1], "/") + for index,version := range(parts) { + if 2 <= len(version) && len(version) <= 4 && strings.HasPrefix(version, "v") { + _, err := strconv.ParseFloat(version[1:], 64) + if err == nil { + // post version suffixes in path are not supported + // version must be on the last index + if index < len(parts) - 1 { + return nil, fmt.Errorf("Path suffixes (after version) are not supported.") + } + switch version { + case "v2.0", "v3": + // valid version found, strip from base + return &gophercloud.ProviderClient{ + IdentityBase: base[0:len(base)-len(version)-1], + IdentityEndpoint: endpoint, + }, nil + default: + return nil, fmt.Errorf("Invalid identity endpoint version %v. Supported versions: v2.0, v3", version) + } + } + } } return &gophercloud.ProviderClient{ diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume/requests.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume/requests.go index dceff3d87..a15c98d39 100644 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume/requests.go +++ b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume/requests.go @@ -79,7 +79,9 @@ func (opts CreateOptsExt) ToServerCreateMap() (map[string]interface{}, error) { blockDevice[i]["source_type"] = bd.SourceType blockDevice[i]["boot_index"] = strconv.Itoa(bd.BootIndex) blockDevice[i]["delete_on_termination"] = strconv.FormatBool(bd.DeleteOnTermination) - blockDevice[i]["volume_size"] = strconv.Itoa(bd.VolumeSize) + if bd.VolumeSize > 0 { + blockDevice[i]["volume_size"] = strconv.Itoa(bd.VolumeSize) + } if bd.UUID != "" { blockDevice[i]["uuid"] = bd.UUID } diff --git a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/errors.go b/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/errors.go index 44761092b..a9e1d5c2f 100644 --- a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/errors.go +++ b/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/errors.go @@ -52,8 +52,8 @@ var ( // It may also indicate that both a DomainID and a DomainName were provided at once. ErrDomainIDOrDomainName = errors.New("You must provide exactly one of DomainID or DomainName to authenticate by Username") - // ErrMissingPassword indicates that no password was provided and no token is available. - ErrMissingPassword = errors.New("You must provide a password to authenticate") + // ErrMissingPassword indicates that no password and no token were provided and no token is available. + ErrMissingPassword = errors.New("You must provide a password or a token to authenticate") // ErrScopeDomainIDOrDomainName indicates that a domain ID or Name was required in a Scope, but not present. ErrScopeDomainIDOrDomainName = errors.New("You must provide exactly one of DomainID or DomainName in a Scope with ProjectName") diff --git a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/requests.go b/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/requests.go index d63b1bb51..2810f2fa2 100644 --- a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/requests.go +++ b/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/requests.go @@ -84,6 +84,9 @@ func Create(c *gophercloud.ServiceClient, options gophercloud.AuthOptions, scope } if options.Password == "" { + if options.TokenID != "" { + c.TokenID = options.TokenID + } if c.TokenID != "" { // Because we aren't using password authentication, it's an error to also provide any of the user-based authentication // parameters. @@ -93,12 +96,6 @@ func Create(c *gophercloud.ServiceClient, options gophercloud.AuthOptions, scope if options.UserID != "" { return createErr(ErrUserIDWithToken) } - if options.DomainID != "" { - return createErr(ErrDomainIDWithToken) - } - if options.DomainName != "" { - return createErr(ErrDomainNameWithToken) - } // Configure the request for Token authentication. req.Auth.Identity.Methods = []string{"token"} diff --git a/vendor/vendor.json b/vendor/vendor.json index 2479e2eb2..7fdb6b9d3 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -1119,16 +1119,16 @@ "revision": "42fa80f2ac6ed17a977ce826074bd3009593fa9d" }, { - "checksumSHA1": "9y6a4i+MNtKDGCbRLtZUCCgra5o=", + "checksumSHA1": "4Q/JrLYYcwGRPVpd6sJ5yW/E9GQ=", "path": "github.com/rackspace/gophercloud", - "revision": "d47105ce4ef90cea9a14b85c8dd172b760085828", - "revisionTime": "2016-06-03T22:34:01Z" + "revision": "985a863d6dd5f928b485dbc8ef440813aafa39ad", + "revisionTime": "2016-06-23T23:57:31Z" }, { - "checksumSHA1": "NGUTP3ljMt7yrbec44cS1snPtTo=", + "checksumSHA1": "dh2tsaicjrx9LgR6uuSeilSFzAY=", "path": "github.com/rackspace/gophercloud/openstack", - "revision": "d47105ce4ef90cea9a14b85c8dd172b760085828", - "revisionTime": "2016-06-03T22:34:01Z" + "revision": "985a863d6dd5f928b485dbc8ef440813aafa39ad", + "revisionTime": "2016-06-23T23:57:31Z" }, { "checksumSHA1": "KXOy+EDMJgyZT0MoTXMhcFZVgNM=", @@ -1149,10 +1149,10 @@ "revisionTime": "2016-06-03T22:34:01Z" }, { - "checksumSHA1": "GCDblO2RKSQRRQQFCUPVG3Okjg8=", + "checksumSHA1": "pQOpY/k5Gh8pUDmsf8ntH6mtGYQ=", "path": "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume", - "revision": "d47105ce4ef90cea9a14b85c8dd172b760085828", - "revisionTime": "2016-06-03T22:34:01Z" + "revision": "985a863d6dd5f928b485dbc8ef440813aafa39ad", + "revisionTime": "2016-06-23T23:57:31Z" }, { "checksumSHA1": "Jpju6sEOCeMRL9SP+zy86ydhPDo=", @@ -1239,10 +1239,10 @@ "revisionTime": "2016-06-03T22:34:01Z" }, { - "checksumSHA1": "mGcd8xg4aongnWHTgjR7kkbyOeQ=", + "checksumSHA1": "yQG3tZgPMFBw2kIp4TR+9E4QH78=", "path": "github.com/rackspace/gophercloud/openstack/identity/v3/tokens", - "revision": "d47105ce4ef90cea9a14b85c8dd172b760085828", - "revisionTime": "2016-06-03T22:34:01Z" + "revision": "985a863d6dd5f928b485dbc8ef440813aafa39ad", + "revisionTime": "2016-06-23T23:57:31Z" }, { "checksumSHA1": "EMdUpMYV9vQAEtBkpUdSqYaYBVc=",