docker-archive / deploykit

A toolkit for creating and managing declarative, self-healing infrastructure.
Apache License 2.0
2.25k stars 262 forks source link

document or better handle plugin discovery directory errors on Linux #287

Closed friism closed 7 years ago

friism commented 7 years ago

INFRAKIT_PLUGINS_DIR

wfarner commented 7 years ago

Relevant panic trace from running a binary with plugin discovery defaults:

$ ./infrakit-group-default
panic: user: Current not implemented on linux/amd64

goroutine 1 [running]:
panic(0x723460, 0xc4200554c0)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/docker/infrakit/discovery.Dir(0x5506b0, 0x7093c0)
        /go/src/github.com/docker/infrakit/discovery/discovery.go:31 +0xfa
github.com/docker/infrakit/discovery.NewPluginDiscovery(0x4, 0xc420035c70, 0x550c46, 0x7093c0)
        /go/src/github.com/docker/infrakit/discovery/discovery.go:38 +0x34
main.main.func1(0xc420116000, 0x956ee0, 0x0, 0x0, 0x0, 0x0)
        /go/src/github.com/docker/infrakit/cmd/group/main.go:33 +0x48
github.com/docker/infrakit/vendor/github.com/spf13/cobra.(*Command).execute(0xc420116000, 0xc420054140, 0x0, 0x0, 0xc420116000, 0xc420054140)
        /go/src/github.com/docker/infrakit/vendor/github.com/spf13/cobra/command.go:632 +0x23e
github.com/docker/infrakit/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc420116000, 0x0, 0x793d6d, 0x16)
        /go/src/github.com/docker/infrakit/vendor/github.com/spf13/cobra/command.go:722 +0x367
github.com/docker/infrakit/vendor/github.com/spf13/cobra.(*Command).Execute(0xc420116000, 0xc420055470, 0x78fdca)
        /go/src/github.com/docker/infrakit/vendor/github.com/spf13/cobra/command.go:681 +0x2b
main.main()
        /go/src/github.com/docker/infrakit/cmd/group/main.go:67 +0x32

You can work around this by setting INFRAKIT_PLUGINS_DIR, but this is non-obvious.

The issue stems from using user.Current(), which is not currently implemented on Linux. Ideally we produce a functioning default for plugin discovery on linux, but at the very least we should detect this condition and inform the user to configure a plugin directory.