vendor: Updating Gophercloud Deps
This commit is contained in:
parent
c0ecbdb27b
commit
1f86d610e3
|
@ -13,14 +13,15 @@ var nilOptions = gophercloud.AuthOptions{}
|
||||||
// environment variables, respectively, remain undefined. See the AuthOptions() function for more details.
|
// environment variables, respectively, remain undefined. See the AuthOptions() function for more details.
|
||||||
var (
|
var (
|
||||||
ErrNoAuthURL = fmt.Errorf("Environment variable OS_AUTH_URL needs to be set.")
|
ErrNoAuthURL = fmt.Errorf("Environment variable OS_AUTH_URL needs to be set.")
|
||||||
ErrNoUsername = fmt.Errorf("Environment variable OS_USERNAME 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 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
|
// AuthOptionsFromEnv fills out an AuthOptions structure from the environment
|
||||||
// OS_* environment variables. The following variables provide sources of truth: OS_AUTH_URL, OS_USERNAME,
|
// variables: OS_AUTH_URL, OS_USERNAME, OS_USERID, OS_PASSWORD, OS_TENANT_ID,
|
||||||
// OS_PASSWORD, OS_TENANT_ID, and OS_TENANT_NAME. Of these, OS_USERNAME, OS_PASSWORD, and OS_AUTH_URL must
|
// OS_TENANT_NAME, OS_DOMAIN_ID, OS_DOMAIN_NAME, OS_TOKEN. It checks that
|
||||||
// have settings, or an error will result. OS_TENANT_ID and OS_TENANT_NAME are optional.
|
// (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) {
|
func AuthOptionsFromEnv() (gophercloud.AuthOptions, error) {
|
||||||
authURL := os.Getenv("OS_AUTH_URL")
|
authURL := os.Getenv("OS_AUTH_URL")
|
||||||
username := os.Getenv("OS_USERNAME")
|
username := os.Getenv("OS_USERNAME")
|
||||||
|
@ -30,16 +31,17 @@ func AuthOptionsFromEnv() (gophercloud.AuthOptions, error) {
|
||||||
tenantName := os.Getenv("OS_TENANT_NAME")
|
tenantName := os.Getenv("OS_TENANT_NAME")
|
||||||
domainID := os.Getenv("OS_DOMAIN_ID")
|
domainID := os.Getenv("OS_DOMAIN_ID")
|
||||||
domainName := os.Getenv("OS_DOMAIN_NAME")
|
domainName := os.Getenv("OS_DOMAIN_NAME")
|
||||||
|
tokenID := os.Getenv("OS_TOKEN")
|
||||||
|
|
||||||
if authURL == "" {
|
if authURL == "" {
|
||||||
return nilOptions, ErrNoAuthURL
|
return nilOptions, ErrNoAuthURL
|
||||||
}
|
}
|
||||||
|
|
||||||
if username == "" && userID == "" {
|
if username == "" && userID == "" && tokenID == "" {
|
||||||
return nilOptions, ErrNoUsername
|
return nilOptions, ErrNoUsername
|
||||||
}
|
}
|
||||||
|
|
||||||
if password == "" {
|
if password == "" && tokenID == "" {
|
||||||
return nilOptions, ErrNoPassword
|
return nilOptions, ErrNoPassword
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +54,7 @@ func AuthOptionsFromEnv() (gophercloud.AuthOptions, error) {
|
||||||
TenantName: tenantName,
|
TenantName: tenantName,
|
||||||
DomainID: domainID,
|
DomainID: domainID,
|
||||||
DomainName: domainName,
|
DomainName: domainName,
|
||||||
|
TokenID: tokenID,
|
||||||
}
|
}
|
||||||
|
|
||||||
return ao, nil
|
return ao, nil
|
||||||
|
|
|
@ -3,6 +3,7 @@ package openstack
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/rackspace/gophercloud"
|
"github.com/rackspace/gophercloud"
|
||||||
|
@ -25,18 +26,40 @@ func NewClient(endpoint string) (*gophercloud.ProviderClient, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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)
|
endpoint = gophercloud.NormalizeURL(endpoint)
|
||||||
base = gophercloud.NormalizeURL(base)
|
base := gophercloud.NormalizeURL(u.String())
|
||||||
|
|
||||||
if hadPath {
|
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{
|
return &gophercloud.ProviderClient{
|
||||||
IdentityBase: base,
|
IdentityBase: base[0:len(base)-len(version)-1],
|
||||||
IdentityEndpoint: endpoint,
|
IdentityEndpoint: endpoint,
|
||||||
}, nil
|
}, nil
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("Invalid identity endpoint version %v. Supported versions: v2.0, v3", version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &gophercloud.ProviderClient{
|
return &gophercloud.ProviderClient{
|
||||||
|
|
|
@ -79,7 +79,9 @@ func (opts CreateOptsExt) ToServerCreateMap() (map[string]interface{}, error) {
|
||||||
blockDevice[i]["source_type"] = bd.SourceType
|
blockDevice[i]["source_type"] = bd.SourceType
|
||||||
blockDevice[i]["boot_index"] = strconv.Itoa(bd.BootIndex)
|
blockDevice[i]["boot_index"] = strconv.Itoa(bd.BootIndex)
|
||||||
blockDevice[i]["delete_on_termination"] = strconv.FormatBool(bd.DeleteOnTermination)
|
blockDevice[i]["delete_on_termination"] = strconv.FormatBool(bd.DeleteOnTermination)
|
||||||
|
if bd.VolumeSize > 0 {
|
||||||
blockDevice[i]["volume_size"] = strconv.Itoa(bd.VolumeSize)
|
blockDevice[i]["volume_size"] = strconv.Itoa(bd.VolumeSize)
|
||||||
|
}
|
||||||
if bd.UUID != "" {
|
if bd.UUID != "" {
|
||||||
blockDevice[i]["uuid"] = bd.UUID
|
blockDevice[i]["uuid"] = bd.UUID
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,8 @@ var (
|
||||||
// It may also indicate that both a DomainID and a DomainName were provided at once.
|
// 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")
|
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 indicates that no password and no token were provided and no token is available.
|
||||||
ErrMissingPassword = errors.New("You must provide a password to authenticate")
|
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 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")
|
ErrScopeDomainIDOrDomainName = errors.New("You must provide exactly one of DomainID or DomainName in a Scope with ProjectName")
|
||||||
|
|
9
vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/requests.go
generated
vendored
9
vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/requests.go
generated
vendored
|
@ -84,6 +84,9 @@ func Create(c *gophercloud.ServiceClient, options gophercloud.AuthOptions, scope
|
||||||
}
|
}
|
||||||
|
|
||||||
if options.Password == "" {
|
if options.Password == "" {
|
||||||
|
if options.TokenID != "" {
|
||||||
|
c.TokenID = options.TokenID
|
||||||
|
}
|
||||||
if c.TokenID != "" {
|
if c.TokenID != "" {
|
||||||
// Because we aren't using password authentication, it's an error to also provide any of the user-based authentication
|
// Because we aren't using password authentication, it's an error to also provide any of the user-based authentication
|
||||||
// parameters.
|
// parameters.
|
||||||
|
@ -93,12 +96,6 @@ func Create(c *gophercloud.ServiceClient, options gophercloud.AuthOptions, scope
|
||||||
if options.UserID != "" {
|
if options.UserID != "" {
|
||||||
return createErr(ErrUserIDWithToken)
|
return createErr(ErrUserIDWithToken)
|
||||||
}
|
}
|
||||||
if options.DomainID != "" {
|
|
||||||
return createErr(ErrDomainIDWithToken)
|
|
||||||
}
|
|
||||||
if options.DomainName != "" {
|
|
||||||
return createErr(ErrDomainNameWithToken)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configure the request for Token authentication.
|
// Configure the request for Token authentication.
|
||||||
req.Auth.Identity.Methods = []string{"token"}
|
req.Auth.Identity.Methods = []string{"token"}
|
||||||
|
|
|
@ -1119,16 +1119,16 @@
|
||||||
"revision": "42fa80f2ac6ed17a977ce826074bd3009593fa9d"
|
"revision": "42fa80f2ac6ed17a977ce826074bd3009593fa9d"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "9y6a4i+MNtKDGCbRLtZUCCgra5o=",
|
"checksumSHA1": "4Q/JrLYYcwGRPVpd6sJ5yW/E9GQ=",
|
||||||
"path": "github.com/rackspace/gophercloud",
|
"path": "github.com/rackspace/gophercloud",
|
||||||
"revision": "d47105ce4ef90cea9a14b85c8dd172b760085828",
|
"revision": "985a863d6dd5f928b485dbc8ef440813aafa39ad",
|
||||||
"revisionTime": "2016-06-03T22:34:01Z"
|
"revisionTime": "2016-06-23T23:57:31Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "NGUTP3ljMt7yrbec44cS1snPtTo=",
|
"checksumSHA1": "dh2tsaicjrx9LgR6uuSeilSFzAY=",
|
||||||
"path": "github.com/rackspace/gophercloud/openstack",
|
"path": "github.com/rackspace/gophercloud/openstack",
|
||||||
"revision": "d47105ce4ef90cea9a14b85c8dd172b760085828",
|
"revision": "985a863d6dd5f928b485dbc8ef440813aafa39ad",
|
||||||
"revisionTime": "2016-06-03T22:34:01Z"
|
"revisionTime": "2016-06-23T23:57:31Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "KXOy+EDMJgyZT0MoTXMhcFZVgNM=",
|
"checksumSHA1": "KXOy+EDMJgyZT0MoTXMhcFZVgNM=",
|
||||||
|
@ -1149,10 +1149,10 @@
|
||||||
"revisionTime": "2016-06-03T22:34:01Z"
|
"revisionTime": "2016-06-03T22:34:01Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "GCDblO2RKSQRRQQFCUPVG3Okjg8=",
|
"checksumSHA1": "pQOpY/k5Gh8pUDmsf8ntH6mtGYQ=",
|
||||||
"path": "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume",
|
"path": "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume",
|
||||||
"revision": "d47105ce4ef90cea9a14b85c8dd172b760085828",
|
"revision": "985a863d6dd5f928b485dbc8ef440813aafa39ad",
|
||||||
"revisionTime": "2016-06-03T22:34:01Z"
|
"revisionTime": "2016-06-23T23:57:31Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "Jpju6sEOCeMRL9SP+zy86ydhPDo=",
|
"checksumSHA1": "Jpju6sEOCeMRL9SP+zy86ydhPDo=",
|
||||||
|
@ -1239,10 +1239,10 @@
|
||||||
"revisionTime": "2016-06-03T22:34:01Z"
|
"revisionTime": "2016-06-03T22:34:01Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "mGcd8xg4aongnWHTgjR7kkbyOeQ=",
|
"checksumSHA1": "yQG3tZgPMFBw2kIp4TR+9E4QH78=",
|
||||||
"path": "github.com/rackspace/gophercloud/openstack/identity/v3/tokens",
|
"path": "github.com/rackspace/gophercloud/openstack/identity/v3/tokens",
|
||||||
"revision": "d47105ce4ef90cea9a14b85c8dd172b760085828",
|
"revision": "985a863d6dd5f928b485dbc8ef440813aafa39ad",
|
||||||
"revisionTime": "2016-06-03T22:34:01Z"
|
"revisionTime": "2016-06-23T23:57:31Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "EMdUpMYV9vQAEtBkpUdSqYaYBVc=",
|
"checksumSHA1": "EMdUpMYV9vQAEtBkpUdSqYaYBVc=",
|
||||||
|
|
Loading…
Reference in New Issue