puppetlabs-toy-chest / wash

Wide Area SHell: a cloud-native shell for bringing remote infrastructure to your terminal.
https://puppetlabs.github.io/wash
Apache License 2.0
180 stars 29 forks source link

Listing S3 bucket contents panics #591

Closed MikaelSmith closed 4 years ago

MikaelSmith commented 4 years ago

Trying to list an S3 bucket panics in Wash 0.13.

wash . ❯ ls aws/role/resources/s3/foo
2019/11/14 22:33:36 http: panic serving : interface conversion: interface {} is *s3.GetBucketLocationOutput, not string
goroutine 6213 [running]:
net/http.(*conn).serve.func1(0xc0123f59a0)
    /usr/local/Cellar/go/1.13.4/libexec/src/net/http/server.go:1767 +0x139
panic(0x5a30e60, 0xc0125717d0)
    /usr/local/Cellar/go/1.13.4/libexec/src/runtime/panic.go:679 +0x1b2
github.com/puppetlabs/wash/plugin/aws.(*s3Bucket).getRegion(0xc01248e500, 0x6192ee0, 0xc0125717a0, 0x5bdcc40, 0xc001987101, 0xc0125717a0, 0xc001987188)
    /Users/michaelsmith/puppetlabs/wash/plugin/aws/s3Bucket.go:275 +0x36b
github.com/puppetlabs/wash/plugin/aws.(*s3Bucket).List(0xc01248e500, 0x6192ee0, 0xc0125717a0, 0x60e9ab0, 0x589e500, 0xc01252f2b0, 0x6192ee0, 0xc0125717a0)
    /Users/michaelsmith/puppetlabs/wash/plugin/aws/s3Bucket.go:193 +0x46
github.com/puppetlabs/wash/plugin.cachedList.func1(0xc000118000, 0x5, 0x5d9c151, 0x10)
    /Users/michaelsmith/puppetlabs/wash/plugin/cache.go:167 +0xf2
github.com/puppetlabs/wash/datastore.(*MemCache).GetOrUpdate(0xc0005d8cc0, 0x5d8ab7d, 0x4, 0xc012269400, 0x32, 0x37e11d600, 0x0, 0xc012571770, 0x0, 0x0, ...)
    /Users/michaelsmith/puppetlabs/wash/datastore/cache.go:136 +0x494
github.com/puppetlabs/wash/plugin.cachedOp(0x6192ee0, 0xc012571260, 0x5d8ab7d, 0x4, 0x61c1ce0, 0xc01248e500, 0x37e11d600, 0xc012571770, 0xc001987520, 0x400c3a5, ...)
    /Users/michaelsmith/puppetlabs/wash/plugin/cache.go:271 +0xf3
github.com/puppetlabs/wash/plugin.cachedDefaultOp(0x6192ee0, 0xc012571260, 0xc01248e500, 0x61c1ce0, 0xc01248e500, 0xc012571770, 0x33, 0x5d8ab7d, 0x4, 0x3)
    /Users/michaelsmith/puppetlabs/wash/plugin/cache.go:245 +0xd6
github.com/puppetlabs/wash/plugin.cachedList(0x6192ee0, 0xc012571260, 0xf9643f8, 0xc01248e500, 0x5d8ab7d, 0x4, 0xf9643f8)
    /Users/michaelsmith/puppetlabs/wash/plugin/cache.go:163 +0xc7
github.com/puppetlabs/wash/plugin.List(...)
    /Users/michaelsmith/puppetlabs/wash/plugin/methodWrappers.go:129
github.com/puppetlabs/wash/plugin.ListWithAnalytics(0x6192ee0, 0xc012571260, 0xf9643f8, 0xc01248e500, 0xc01248e500, 0xc01248e500, 0xc001987601)
    /Users/michaelsmith/puppetlabs/wash/plugin/analyticsWrappers.go:14 +0xb2
github.com/puppetlabs/wash/api.glob..func8(0x618a320, 0xc0125428c0, 0xc0125da300, 0xa)
    /Users/michaelsmith/puppetlabs/wash/api/list.go:49 +0x142
github.com/puppetlabs/wash/api.handler.ServeHTTP(0x5e55a90, 0x618a320, 0xc0125428c0, 0xc0125da300)
    /Users/michaelsmith/puppetlabs/wash/api/server.go:49 +0x144
github.com/puppetlabs/wash/api.StartAPI.func1.1(0x618a320, 0xc0125428c0, 0xc0125da200)
    /Users/michaelsmith/puppetlabs/wash/api/server.go:112 +0x444
net/http.HandlerFunc.ServeHTTP(0xc012579040, 0x618a320, 0xc0125428c0, 0xc0125da200)
    /usr/local/Cellar/go/1.13.4/libexec/src/net/http/server.go:2007 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00045f420, 0x618a320, 0xc0125428c0, 0xc0125da200)
    /Users/michaelsmith/.go/pkg/mod/github.com/gorilla/mux@v1.6.2/mux.go:162 +0x104
net/http.serverHandler.ServeHTTP(0xc0003ba460, 0x618a320, 0xc0125428c0, 0xc0125da000)
    /usr/local/Cellar/go/1.13.4/libexec/src/net/http/server.go:2802 +0xa4
net/http.(*conn).serve(0xc0123f59a0, 0x6192e20, 0xc01259da00)
    /usr/local/Cellar/go/1.13.4/libexec/src/net/http/server.go:1890 +0x875
created by net/http.(*Server).Serve
    /usr/local/Cellar/go/1.13.4/libexec/src/net/http/server.go:2927 +0x38e