Prechádzať zdrojové kódy

registry: remove unused fallbackError

Nothing was emitting this error.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 3 rokov pred
rodič
commit
5e9829b75d
2 zmenil súbory, kde vykonal 9 pridanie a 24 odobranie
  1. 0 8
      registry/auth.go
  2. 9 16
      registry/service.go

+ 0 - 8
registry/auth.go

@@ -63,14 +63,6 @@ func (scs staticCredentialStore) RefreshToken(*url.URL, string) string {
 func (scs staticCredentialStore) SetRefreshToken(*url.URL, string, string) {
 func (scs staticCredentialStore) SetRefreshToken(*url.URL, string, string) {
 }
 }
 
 
-type fallbackError struct {
-	err error
-}
-
-func (err fallbackError) Error() string {
-	return err.err.Error()
-}
-
 // loginV2 tries to login to the v2 registry server. The given registry
 // loginV2 tries to login to the v2 registry server. The given registry
 // endpoint will be pinged to get authorization challenges. These challenges
 // endpoint will be pinged to get authorization challenges. These challenges
 // will be used to authenticate against the registry to validate credentials.
 // will be used to authenticate against the registry to validate credentials.

+ 9 - 16
registry/service.go

@@ -175,23 +175,16 @@ func (s *defaultService) Search(ctx context.Context, term string, limit int, aut
 		modifiers := Headers(userAgent, nil)
 		modifiers := Headers(userAgent, nil)
 		v2Client, err := v2AuthHTTPClient(endpoint.URL, endpoint.client.Transport, modifiers, creds, scopes)
 		v2Client, err := v2AuthHTTPClient(endpoint.URL, endpoint.client.Transport, modifiers, creds, scopes)
 		if err != nil {
 		if err != nil {
-			if fErr, ok := err.(fallbackError); ok {
-				logrus.WithError(fErr.err).Error("cannot use identity token for search, v2 auth not supported")
-			} else {
-				return nil, err
-			}
-		} else {
-			// Copy non transport http client features
-			v2Client.Timeout = endpoint.client.Timeout
-			v2Client.CheckRedirect = endpoint.client.CheckRedirect
-			v2Client.Jar = endpoint.client.Jar
-
-			logrus.Debugf("using v2 client for search to %s", endpoint.URL)
-			client = v2Client
+			return nil, err
 		}
 		}
-	}
-
-	if client == nil {
+		// Copy non transport http client features
+		v2Client.Timeout = endpoint.client.Timeout
+		v2Client.CheckRedirect = endpoint.client.CheckRedirect
+		v2Client.Jar = endpoint.client.Jar
+
+		logrus.Debugf("using v2 client for search to %s", endpoint.URL)
+		client = v2Client
+	} else {
 		client = endpoint.client
 		client = endpoint.client
 		if err := authorizeClient(client, authConfig, endpoint); err != nil {
 		if err := authorizeClient(client, authConfig, endpoint); err != nil {
 			return nil, err
 			return nil, err