Pārlūkot izejas kodu

Merge pull request #19551 from aaronlehmann/fix-retry-on-enospc

Don't retry downloads when disk is full
Tibor Vass 9 gadi atpakaļ
vecāks
revīzija
26334b7a7d
1 mainītis faili ar 5 papildinājumiem un 0 dzēšanām
  1. 5 0
      distribution/registry.go

+ 5 - 0
distribution/registry.go

@@ -6,6 +6,7 @@ import (
 	"net/http"
 	"net/http"
 	"net/url"
 	"net/url"
 	"strings"
 	"strings"
+	"syscall"
 	"time"
 	"time"
 
 
 	"github.com/docker/distribution"
 	"github.com/docker/distribution"
@@ -149,6 +150,10 @@ func retryOnError(err error) error {
 		return retryOnError(v.Err)
 		return retryOnError(v.Err)
 	case *client.UnexpectedHTTPResponseError:
 	case *client.UnexpectedHTTPResponseError:
 		return xfer.DoNotRetry{Err: err}
 		return xfer.DoNotRetry{Err: err}
+	case error:
+		if strings.Contains(err.Error(), strings.ToLower(syscall.ENOSPC.Error())) {
+			return xfer.DoNotRetry{Err: err}
+		}
 	}
 	}
 	// let's be nice and fallback if the error is a completely
 	// let's be nice and fallback if the error is a completely
 	// unexpected one.
 	// unexpected one.