Update Gophercloud dependency for reauth problem

Fixes picked up from gophercloud are:
443743e883...0b6b13c4dd

Including the one for endless loop on reauth:
https://github.com/gophercloud/gophercloud/pull/604
pull/6/head
Davanum Srinivas 2017-11-13 22:16:20 -05:00
parent 48d062722b
commit 4366454fbe
15 changed files with 152 additions and 55 deletions

52
Godeps/Godeps.json generated
View File

@ -1617,107 +1617,107 @@
},
{
"ImportPath": "github.com/gophercloud/gophercloud",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumes",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/blockstorage/v2/volumes",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/common/extensions",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/volumeattach",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/compute/v2/flavors",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/compute/v2/images",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/compute/v2/servers",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/identity/v2/tenants",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/identity/v2/tokens",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/identity/v3/extensions/trusts",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/identity/v3/tokens",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/floatingips",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/routers",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/lbaas_v2/listeners",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/lbaas_v2/loadbalancers",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/lbaas_v2/monitors",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/lbaas_v2/pools",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/security/groups",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/security/rules",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/networking/v2/ports",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/utils",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/pagination",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gorilla/context",

View File

@ -408,31 +408,31 @@
},
{
"ImportPath": "github.com/gophercloud/gophercloud",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/identity/v2/tenants",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/identity/v2/tokens",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/identity/v3/tokens",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/utils",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/pagination",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gregjones/httpcache",

View File

@ -172,31 +172,31 @@
},
{
"ImportPath": "github.com/gophercloud/gophercloud",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/identity/v2/tenants",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/identity/v2/tokens",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/identity/v3/tokens",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/openstack/utils",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gophercloud/gophercloud/pagination",
"Rev": "443743e88335413103dcf1997e46d401b264fbcd"
"Rev": "0b6b13c4dd9e07a89f83cbe4617c13ad646d6362"
},
{
"ImportPath": "github.com/gregjones/httpcache",

View File

@ -1 +1,2 @@
**/*.swp
.idea

12
vendor/github.com/gophercloud/gophercloud/.zuul.yaml generated vendored Normal file
View File

@ -0,0 +1,12 @@
- project:
name: gophercloud/gophercloud
check:
jobs:
- gophercloud-unittest
- gophercloud-acceptance-test
recheck-mitaka:
jobs:
- gophercloud-acceptance-test-mitaka
recheck-pike:
jobs:
- gophercloud-acceptance-test-pike

View File

@ -346,3 +346,11 @@ func NewImageServiceV2(client *gophercloud.ProviderClient, eo gophercloud.Endpoi
sc.ResourceBase = sc.Endpoint + "v2/"
return sc, err
}
// NewLoadBalancerV2 creates a ServiceClient that may be used to access the v2
// load balancer service.
func NewLoadBalancerV2(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
sc, err := initClientOpts(client, eo, "load-balancer")
sc.ResourceBase = sc.Endpoint + "v2.0/"
return sc, err
}

View File

@ -41,5 +41,23 @@ Example to Create a Flavor
if err != nil {
panic(err)
}
Example to List Flavor Access
flavorID := "e91758d6-a54a-4778-ad72-0c73a1cb695b"
allPages, err := flavors.ListAccesses(computeClient, flavorID).AllPages()
if err != nil {
panic(err)
}
allAccesses, err := flavors.ExtractAccesses(allPages)
if err != nil {
panic(err)
}
for _, access := range allAccesses {
fmt.Printf("%+v", access)
}
*/
package flavors

View File

@ -43,7 +43,6 @@ const (
the Marker for the current call.
*/
type ListOpts struct {
// ChangesSince, if provided, instructs List to return only those things which
// have changed since the timestamp provided.
ChangesSince string `q:"changes-since"`
@ -154,6 +153,15 @@ func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult) {
return
}
// ListAccesses retrieves the tenants which have access to a flavor.
func ListAccesses(client *gophercloud.ServiceClient, id string) pagination.Pager {
url := accessURL(client, id)
return pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page {
return AccessPage{pagination.SinglePageBase(r)}
})
}
// IDFromName is a convienience function that returns a flavor's ID given its
// name.
func IDFromName(client *gophercloud.ServiceClient, name string) (string, error) {

View File

@ -12,6 +12,8 @@ type commonResult struct {
gophercloud.Result
}
// CreateResult is the response of a Get operations. Call its Extract method to
// interpret it as a Flavor.
type CreateResult struct {
commonResult
}
@ -131,3 +133,32 @@ func ExtractFlavors(r pagination.Page) ([]Flavor, error) {
err := (r.(FlavorPage)).ExtractInto(&s)
return s.Flavors, err
}
// AccessPage contains a single page of all FlavorAccess entries for a flavor.
type AccessPage struct {
pagination.SinglePageBase
}
// IsEmpty indicates whether an AccessPage is empty.
func (page AccessPage) IsEmpty() (bool, error) {
v, err := ExtractAccesses(page)
return len(v) == 0, err
}
// ExtractAccesses interprets a page of results as a slice of FlavorAccess.
func ExtractAccesses(r pagination.Page) ([]FlavorAccess, error) {
var s struct {
FlavorAccesses []FlavorAccess `json:"flavor_access"`
}
err := (r.(AccessPage)).ExtractInto(&s)
return s.FlavorAccesses, err
}
// FlavorAccess represents an ACL of tenant access to a specific Flavor.
type FlavorAccess struct {
// FlavorID is the unique ID of the flavor.
FlavorID string `json:"flavor_id"`
// TenantID is the unique ID of the tenant.
TenantID string `json:"tenant_id"`
}

View File

@ -19,3 +19,7 @@ func createURL(client *gophercloud.ServiceClient) string {
func deleteURL(client *gophercloud.ServiceClient, id string) string {
return client.ServiceURL("flavors", id)
}
func accessURL(client *gophercloud.ServiceClient, id string) string {
return client.ServiceURL("flavors", id, "os-flavor-access")
}

View File

@ -211,6 +211,16 @@ type Server struct {
// SecurityGroups includes the security groups that this instance has applied
// to it.
SecurityGroups []map[string]interface{} `json:"security_groups"`
// Fault contains failure information about a server.
Fault Fault `json:"fault"`
}
type Fault struct {
Code int `json:"code"`
Created time.Time `json:"created"`
Details string `json:"details"`
Message string `json:"message"`
}
func (r *Server) UnmarshalJSON(b []byte) error {

View File

@ -9,6 +9,7 @@ import (
// particular network router.
type GatewayInfo struct {
NetworkID string `json:"network_id"`
EnableSNAT *bool `json:"enable_snat,omitempty"`
ExternalFixedIPs []ExternalFixedIP `json:"external_fixed_ips,omitempty"`
}

View File

@ -11,11 +11,13 @@ type commonResult struct {
// Extract is a function that accepts a result and extracts a port resource.
func (r commonResult) Extract() (*Port, error) {
var s struct {
Port *Port `json:"port"`
}
var s Port
err := r.ExtractInto(&s)
return s.Port, err
return &s, err
}
func (r commonResult) ExtractInto(v interface{}) error {
return r.Result.ExtractIntoStructPtr(v, "port")
}
// CreateResult represents the result of a create operation. Call its Extract
@ -128,9 +130,11 @@ func (r PortPage) IsEmpty() (bool, error) {
// and extracts the elements into a slice of Port structs. In other words,
// a generic collection is mapped into a relevant slice.
func ExtractPorts(r pagination.Page) ([]Port, error) {
var s struct {
Ports []Port `json:"ports"`
}
err := (r.(PortPage)).ExtractInto(&s)
return s.Ports, err
var s []Port
err := ExtractPortsInto(r, &s)
return s, err
}
func ExtractPortsInto(r pagination.Page, v interface{}) error {
return r.(PortPage).Result.ExtractIntoSlicePtr(v, "ports")
}

View File

@ -22,7 +22,6 @@ var (
// Depending on the pagination strategy of a particular resource, there may be an additional subinterface that the result type
// will need to implement.
type Page interface {
// NextPageURL generates the URL for the page of data that follows this collection.
// Return "" if no such page exists.
NextPageURL() (string, error)

View File

@ -145,10 +145,6 @@ func (client *ProviderClient) Request(method, url string, options *RequestOpts)
}
req.Header.Set("Accept", applicationJSON)
for k, v := range client.AuthenticatedHeaders() {
req.Header.Add(k, v)
}
// Set the User-Agent header
req.Header.Set("User-Agent", client.UserAgent.Join())
@ -162,6 +158,11 @@ func (client *ProviderClient) Request(method, url string, options *RequestOpts)
}
}
// get latest token from client
for k, v := range client.AuthenticatedHeaders() {
req.Header.Set(k, v)
}
// Set connection parameter to close the connection immediately when we've got the response
req.Close = true