rackspace / gophercloud

A Go SDK for OpenStack. IN FEATURE FREEZE. See Issue #592
http://gophercloud.io
Other
456 stars 181 forks source link

panic using server.ListAddresses(...).AllPages() #566

Closed dangogh closed 8 years ago

dangogh commented 8 years ago

NOTE: I have a commit which adds a test for this error and checks the type assertion to panic with more detail. I'll submit a PR if requested..

trying to get list of addresses from servers, I did something like this:

       p, err := ListAddresses(client, myserver.ID).AllPages()
       addrs, err := ExtractAddresses(p)

I get the following panic:

panic: interface conversion: interface is map[string]interface {}, not []interface {} [recovered]
    panic: interface conversion: interface is map[string]interface {}, not []interface {}
goroutine 151 [running]:
panic(0x3f8c40, 0xc820013c80)
...
github.com/rackspace/gophercloud/pagination.Pager.AllPages.func1(0xb88530, 0xc82008abe0, 0x0, 0x0, 0x0)
    /Users/dank/Code/src/github.com/rackspace/gophercloud/pagination/pager.go:156 +0x279
jrperritt commented 8 years ago

Confirmed. Working on a fix now.

jrperritt commented 8 years ago

@dangogh can you go get -u github.com/rackspace/gophercloud and confirm this has been fixed?

dangogh commented 8 years ago

That was quick :-) Confirmed.. Thanks!

jrperritt commented 8 years ago

Thank you for filing the bug :)