cruise-automation / daytona

A Vault client, but for containers and servers.
Apache License 2.0
310 stars 33 forks source link

Fix panic when vault return a map #62

Closed afarbos closed 4 years ago

afarbos commented 4 years ago

If vault api return an map we are currently panicking, see below:

panic: interface conversion: interface {} is map[string]interface {}, not string

goroutine 1 [running]:
github.com/cruise-automation/daytona/pkg/secrets.(*SecretDefinition).addSecrets(0xc0001c7730, 0xc00029a770, 0xc0000bc090, 0x0, 0x4)
    /Users/myuser/daytona/pkg/secrets/secrets.go:235 +0x9c8
github.com/cruise-automation/daytona/pkg/secrets.SecretFetcher(0xc00029a770, 0x0, 0x0, 0x7ffeefbff6dd, 0x21, 0x177f0fc, 0x33, 0x0, 0x1763bb4, 0xa, ...)
    /Users/myuser/daytona/pkg/secrets/secrets.go:128 +0x62a
main.main()
    /Users/myuser/daytona/cmd/daytona/main.go:202 +0x318

This fix will avoid and panic and replicate vault read behavior.

$ vault read -field=foo secret/foo
map[bar:baz]