config/credentials: don't run 'pass' to detect it

'CheckInitialized' in the credential-helper library actually invokes
`pass`, which isn't desirable (see #699).

This moves the check to be simpler, and then pass will only be invoked
when it's needed (such as for `docker login` or when pulling from a
private registry).

This logic could also reasonably live in the credential-helper library,
but it's simple enough it seems fine in either location.

Signed-off-by: Euan Kemp <euank@euank.com>
This commit is contained in:
Euan Kemp
2018-06-29 02:18:04 -07:00
parent ea65e9043c
commit 056015c3d8
2 changed files with 2 additions and 210 deletions

View File

@ -1,12 +1,11 @@
package credentials
import (
"github.com/docker/docker-credential-helpers/pass"
"os/exec"
)
func defaultCredentialsStore() string {
passStore := pass.Pass{}
if passStore.CheckInitialized() {
if _, err := exec.LookPath("pass"); err == nil {
return "pass"
}