mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
registry.Auth: try next endpoints on non-auth failures
Allow falling back to non-TLS endpoints if present. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
588da41f52
commit
80cc1f1d6f
1 changed files with 9 additions and 1 deletions
|
@ -131,7 +131,15 @@ func (s *DefaultService) Auth(ctx context.Context, authConfig *types.AuthConfig,
|
|||
}
|
||||
|
||||
for _, endpoint := range endpoints {
|
||||
return loginV2(authConfig, endpoint, userAgent)
|
||||
status, token, err = loginV2(authConfig, endpoint, userAgent)
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
if errdefs.IsUnauthorized(err) {
|
||||
// Failed to authenticate; don't continue with (non-TLS) endpoints.
|
||||
return status, token, err
|
||||
}
|
||||
logrus.WithError(err).Infof("Error logging in to endpoint, trying next endpoint")
|
||||
}
|
||||
|
||||
return "", "", err
|
||||
|
|
Loading…
Add table
Reference in a new issue