mirror of https://github.com/docker/cli.git
cli/config/credentials: skip unneeded exec.LookPath()
defaultCredentialsStore() on Linux does an exec.LookPath() for "pass", but if a custom credential-store is passed to DetectDefaultStore, the result of that won't be used. This patch changes the logic to return early if a custom credential-store is passed. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
b403a49207
commit
ce11b28d83
|
@ -5,17 +5,20 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// DetectDefaultStore return the default credentials store for the platform if
|
// DetectDefaultStore return the default credentials store for the platform if
|
||||||
// the store executable is available.
|
// no user-defined store is passed, and the store executable is available.
|
||||||
func DetectDefaultStore(store string) string {
|
func DetectDefaultStore(store string) string {
|
||||||
platformDefault := defaultCredentialsStore()
|
if store != "" {
|
||||||
|
// use user-defined
|
||||||
// user defined or no default for platform
|
|
||||||
if store != "" || platformDefault == "" {
|
|
||||||
return store
|
return store
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := exec.LookPath(remoteCredentialsPrefix + platformDefault); err == nil {
|
platformDefault := defaultCredentialsStore()
|
||||||
return platformDefault
|
if platformDefault == "" {
|
||||||
}
|
|
||||||
return ""
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := exec.LookPath(remoteCredentialsPrefix + platformDefault); err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return platformDefault
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue