Manual follow-on tweaks to get the build green again.
diff --git a/openstack/cdn/v1/services/requests.go b/openstack/cdn/v1/services/requests.go
index 73a9436..78a3087 100644
--- a/openstack/cdn/v1/services/requests.go
+++ b/openstack/cdn/v1/services/requests.go
@@ -181,7 +181,7 @@
JSONBody: &reqBody,
OkCodes: []int{202},
})
- res.Header = resp.HttpResponse.Header
+ res.Header = resp.Header
res.Err = err
return res
}
@@ -361,7 +361,7 @@
OkCodes: []int{202},
})
var result UpdateResult
- result.Header = resp.HttpResponse.Header
+ result.Header = resp.Header
result.Err = err
return result
}
diff --git a/openstack/client.go b/openstack/client.go
index 5fce3d6..63e07b8 100644
--- a/openstack/client.go
+++ b/openstack/client.go
@@ -68,7 +68,7 @@
&utils.Version{ID: v30, Priority: 30, Suffix: "/v3/"},
}
- chosen, endpoint, err := utils.ChooseVersion(client.IdentityBase, client.IdentityEndpoint, versions)
+ chosen, endpoint, err := utils.ChooseVersion(client, versions)
if err != nil {
return err
}
diff --git a/openstack/identity/v3/tokens/requests.go b/openstack/identity/v3/tokens/requests.go
index ff958c7..bbd3c56 100644
--- a/openstack/identity/v3/tokens/requests.go
+++ b/openstack/identity/v3/tokens/requests.go
@@ -1,7 +1,8 @@
package tokens
import (
- "github.com/racker/perigee"
+ "net/http"
+
"github.com/rackspace/gophercloud"
)
@@ -233,7 +234,7 @@
}
var result CreateResult
- var response *perigee.Response
+ var response *http.Response
response, result.Err = c.Request("POST", tokenURL(c), gophercloud.RequestOpts{
JSONBody: &req,
JSONResponse: &result.Body,
@@ -242,14 +243,14 @@
if result.Err != nil {
return result
}
- result.Header = response.HttpResponse.Header
+ result.Header = response.Header
return result
}
// Get validates and retrieves information about another token.
func Get(c *gophercloud.ServiceClient, token string) GetResult {
var result GetResult
- var response *perigee.Response
+ var response *http.Response
response, result.Err = c.Request("GET", tokenURL(c), gophercloud.RequestOpts{
MoreHeaders: subjectTokenHeaders(c, token),
JSONResponse: &result.Body,
@@ -258,7 +259,7 @@
if result.Err != nil {
return result
}
- result.Header = response.HttpResponse.Header
+ result.Header = response.Header
return result
}
diff --git a/openstack/objectstorage/v1/accounts/requests.go b/openstack/objectstorage/v1/accounts/requests.go
index 846ec0c..3e404c3 100644
--- a/openstack/objectstorage/v1/accounts/requests.go
+++ b/openstack/objectstorage/v1/accounts/requests.go
@@ -43,7 +43,7 @@
MoreHeaders: h,
OkCodes: []int{204},
})
- res.Header = resp.HttpResponse.Header
+ res.Header = resp.Header
res.Err = err
return res
}
@@ -80,7 +80,7 @@
// To extract the headers returned, call the Extract method on the UpdateResult.
func Update(c *gophercloud.ServiceClient, opts UpdateOptsBuilder) UpdateResult {
var res UpdateResult
- h := c.AuthenticatedHeaders()
+ h := make(map[string]string)
if opts != nil {
headers, err := opts.ToAccountUpdateMap()
@@ -97,7 +97,7 @@
MoreHeaders: h,
OkCodes: []int{204},
})
- res.Header = resp.HttpResponse.Header
+ res.Header = resp.Header
res.Err = err
return res
}
diff --git a/openstack/objectstorage/v1/objects/requests.go b/openstack/objectstorage/v1/objects/requests.go
index a4faad1..8b5fed8 100644
--- a/openstack/objectstorage/v1/objects/requests.go
+++ b/openstack/objectstorage/v1/objects/requests.go
@@ -136,9 +136,9 @@
OkCodes: []int{200, 304},
})
- res.Body = resp.HttpResponse.Body
+ res.Body = resp.Body
res.Err = err
- res.Header = resp.HttpResponse.Header
+ res.Header = resp.Header
return res
}
@@ -279,7 +279,7 @@
MoreHeaders: h,
OkCodes: []int{201},
})
- res.Header = resp.HttpResponse.Header
+ res.Header = resp.Header
res.Err = err
return res
}
@@ -321,7 +321,7 @@
resp, err := c.Request("DELETE", url, gophercloud.RequestOpts{
OkCodes: []int{204},
})
- res.Header = resp.HttpResponse.Header
+ res.Header = resp.Header
res.Err = err
return res
}
@@ -365,7 +365,7 @@
resp, err := c.Request("HEAD", url, gophercloud.RequestOpts{
OkCodes: []int{200, 204},
})
- res.Header = resp.HttpResponse.Header
+ res.Header = resp.Header
res.Err = err
return res
}
@@ -422,7 +422,7 @@
MoreHeaders: h,
OkCodes: []int{202},
})
- res.Header = resp.HttpResponse.Header
+ res.Header = resp.Header
res.Err = err
return res
}
diff --git a/openstack/utils/choose_version.go b/openstack/utils/choose_version.go
index 52f37a9..b697ba8 100644
--- a/openstack/utils/choose_version.go
+++ b/openstack/utils/choose_version.go
@@ -23,7 +23,7 @@
// ChooseVersion queries the base endpoint of an API to choose the most recent non-experimental alternative from a service's
// published versions.
// It returns the highest-Priority Version among the alternatives that are provided, as well as its corresponding endpoint.
-func ChooseVersion(identityBase string, identityEndpoint string, recognized []*Version) (*Version, string, error) {
+func ChooseVersion(client *gophercloud.ProviderClient, recognized []*Version) (*Version, string, error) {
type linkResp struct {
Href string `json:"href"`
Rel string `json:"rel"`
@@ -49,7 +49,7 @@
}
return endpoint
}
- identityEndpoint = normalize(identityEndpoint)
+ identityEndpoint := normalize(client.IdentityEndpoint)
// If a full endpoint is specified, check version suffixes for a match first.
for _, v := range recognized {
@@ -59,7 +59,7 @@
}
var resp response
- _, err := client.Request("GET", identityBase, gophercloud.RequestOpts{
+ _, err := client.Request("GET", client.IdentityBase, gophercloud.RequestOpts{
JSONResponse: &resp,
OkCodes: []int{200, 300},
})
@@ -88,7 +88,7 @@
// Prefer a version that exactly matches the provided endpoint.
if href == identityEndpoint {
if href == "" {
- return nil, "", fmt.Errorf("Endpoint missing in version %s response from %s", value.ID, identityBase)
+ return nil, "", fmt.Errorf("Endpoint missing in version %s response from %s", value.ID, client.IdentityBase)
}
return matching, href, nil
}
@@ -104,10 +104,10 @@
}
if highest == nil {
- return nil, "", fmt.Errorf("No supported version available from endpoint %s", identityBase)
+ return nil, "", fmt.Errorf("No supported version available from endpoint %s", client.IdentityBase)
}
if endpoint == "" {
- return nil, "", fmt.Errorf("Endpoint missing in version %s response from %s", highest.ID, identityBase)
+ return nil, "", fmt.Errorf("Endpoint missing in version %s response from %s", highest.ID, client.IdentityBase)
}
return highest, endpoint, nil
diff --git a/openstack/utils/choose_version_test.go b/openstack/utils/choose_version_test.go
index 9552696..388d689 100644
--- a/openstack/utils/choose_version_test.go
+++ b/openstack/utils/choose_version_test.go
@@ -5,6 +5,7 @@
"net/http"
"testing"
+ "github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/testhelper"
)
@@ -43,7 +44,11 @@
v2 := &Version{ID: "v2.0", Priority: 2, Suffix: "blarg"}
v3 := &Version{ID: "v3.0", Priority: 3, Suffix: "hargl"}
- v, endpoint, err := ChooseVersion(testhelper.Endpoint(), "", []*Version{v2, v3})
+ c := &gophercloud.ProviderClient{
+ IdentityBase: testhelper.Endpoint(),
+ IdentityEndpoint: "",
+ }
+ v, endpoint, err := ChooseVersion(c, []*Version{v2, v3})
if err != nil {
t.Fatalf("Unexpected error from ChooseVersion: %v", err)
@@ -67,7 +72,11 @@
v2 := &Version{ID: "v2.0", Priority: 2, Suffix: "nope"}
v3 := &Version{ID: "v3.0", Priority: 3, Suffix: "northis"}
- v, endpoint, err := ChooseVersion(testhelper.Endpoint(), testhelper.Endpoint()+"v2.0/", []*Version{v2, v3})
+ c := &gophercloud.ProviderClient{
+ IdentityBase: testhelper.Endpoint(),
+ IdentityEndpoint: testhelper.Endpoint() + "v2.0/",
+ }
+ v, endpoint, err := ChooseVersion(c, []*Version{v2, v3})
if err != nil {
t.Fatalf("Unexpected error from ChooseVersion: %v", err)
}
@@ -89,7 +98,11 @@
v2 := &Version{ID: "v2.0", Priority: 2, Suffix: "/v2.0/"}
v3 := &Version{ID: "v3.0", Priority: 3, Suffix: "/v3.0/"}
- v, endpoint, err := ChooseVersion(testhelper.Endpoint(), testhelper.Endpoint()+"v2.0/", []*Version{v2, v3})
+ c := &gophercloud.ProviderClient{
+ IdentityBase: testhelper.Endpoint(),
+ IdentityEndpoint: testhelper.Endpoint() + "v2.0/",
+ }
+ v, endpoint, err := ChooseVersion(c, []*Version{v2, v3})
if err != nil {
t.Fatalf("Unexpected error from ChooseVersion: %v", err)
}
diff --git a/provider_client.go b/provider_client.go
index 092a078..3316733 100644
--- a/provider_client.go
+++ b/provider_client.go
@@ -59,7 +59,7 @@
// JSONResponse, if provided, will be populated with the contents of the response body parsed as
// JSON.
- JSONResponse *interface{}
+ JSONResponse interface{}
// OkCodes contains a list of numeric HTTP status codes that should be interpreted as success. If
// the response has a different code, an error will be returned.
OkCodes []int
diff --git a/rackspace/client.go b/rackspace/client.go
index 439d846..039f446 100644
--- a/rackspace/client.go
+++ b/rackspace/client.go
@@ -59,7 +59,7 @@
&utils.Version{ID: v20, Priority: 20, Suffix: "/v2.0/"},
}
- chosen, endpoint, err := utils.ChooseVersion(client.IdentityBase, client.IdentityEndpoint, versions)
+ chosen, endpoint, err := utils.ChooseVersion(client, versions)
if err != nil {
return err
}