mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
docker: improve error message for auth helper
The error returned from the stdlib's `exec` package is always a message with the exit code of the exec'd process, not any error message that process might have given us. This results in opaque failures for the Nomad user. Cast to an `ExitError` so that we can access the output from stderr.
This commit is contained in:
@@ -156,12 +156,12 @@ func authFromHelper(helperName string) authBackend {
|
||||
cmd.Stdin = strings.NewReader(repoInfo.Index.Name)
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
switch err.(type) {
|
||||
default:
|
||||
return nil, err
|
||||
case *exec.ExitError:
|
||||
return nil, fmt.Errorf("%s with input %q failed with stderr: %s", helper, repo, err.Error())
|
||||
exitErr, ok := err.(*exec.ExitError)
|
||||
if ok {
|
||||
return nil, fmt.Errorf(
|
||||
"%s with input %q failed with stderr: %s", helper, repo, exitErr.Stderr)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var response map[string]string
|
||||
|
||||
Reference in New Issue
Block a user