Convert ListImages to use reauth.
This commit does not work -- acceptance test 08-... is broken.
diff --git a/images.go b/images.go
index 9126b93..cc3f6e2 100644
--- a/images.go
+++ b/images.go
@@ -7,13 +7,15 @@
// See the CloudImagesProvider interface for details.
func (gsp *genericServersProvider) ListImages() ([]Image, error) {
var is []Image
- url := gsp.endpoint + "/images"
- err := perigee.Get(url, perigee.Options{
- CustomClient: gsp.context.httpClient,
- Results: &struct{ Images *[]Image }{&is},
- MoreHeaders: map[string]string{
- "X-Auth-Token": gsp.access.AuthToken(),
- },
+ err := gsp.context.WithReauth(gsp.access, func() error {
+ url := gsp.endpoint + "/images"
+ return perigee.Get(url, perigee.Options{
+ CustomClient: gsp.context.httpClient,
+ Results: &struct{ Images *[]Image }{&is},
+ MoreHeaders: map[string]string{
+ "X-Auth-Token": gsp.access.AuthToken(),
+ },
+ })
})
return is, err
}