Skip to content

Commit 8606144

Browse files
committed
log fallback errors as "info"
Fallback errors are not an error, but an informational message. This changes those errors to be logged as "Info" instead of "Error". After this patch, debug logs look like this; DEBU[0050] Calling GET /_ping DEBU[0050] Calling POST /v1.27/images/create?fromImage=localhost%3A5000%2Ffoo&tag=latest DEBU[0050] Trying to pull localhost:5000/foo from https://localhost:5000 v2 WARN[0050] Error getting v2 registry: Get https://localhost:5000/v2/: http: server gave HTTP response to HTTPS client INFO[0050] Attempting next endpoint for pull after error: Get https://localhost:5000/v2/: http: server gave HTTP response to HTTPS client DEBU[0050] Trying to pull localhost:5000/foo from http://localhost:5000 v2 INFO[0050] Attempting next endpoint for pull after error: manifest unknown: manifest unknown DEBU[0050] Trying to pull localhost:5000/foo from https://localhost:5000 v1 DEBU[0050] attempting v1 ping for registry endpoint https://localhost:5000/v1/ DEBU[0050] Fallback from error: Get https://localhost:5000/v1/_ping: http: server gave HTTP response to HTTPS client INFO[0050] Attempting next endpoint for pull after error: Get https://localhost:5000/v1/_ping: http: server gave HTTP response to HTTPS client DEBU[0050] Trying to pull localhost:5000/foo from http://localhost:5000 v1 DEBU[0050] [registry] Calling GET http://localhost:5000/v1/repositories/foo/images ERRO[0050] Not continuing with pull after error: Error: image foo:latest not found Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 87e4562 commit 8606144

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

distribution/pull.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func Pull(ctx context.Context, ref reference.Named, imagePullConfig *ImagePullCo
140140
// append subsequent errors
141141
lastErr = err
142142
}
143-
logrus.Errorf("Attempting next endpoint for pull after error: %v", err)
143+
logrus.Infof("Attempting next endpoint for pull after error: %v", err)
144144
continue
145145
}
146146
logrus.Errorf("Not continuing with pull after error: %v", err)

distribution/pull_v2.go

-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ func (p *v2Puller) Pull(ctx context.Context, ref reference.Named) (err error) {
7373
return err
7474
}
7575
if continueOnError(err) {
76-
logrus.Errorf("Error trying v2 registry: %v", err)
7776
return fallbackError{
7877
err: err,
7978
confirmedV2: p.confirmedV2,

distribution/push.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func Push(ctx context.Context, ref reference.Named, imagePushConfig *ImagePushCo
126126
}
127127
err = fallbackErr.err
128128
lastErr = err
129-
logrus.Errorf("Attempting next endpoint for push after error: %v", err)
129+
logrus.Infof("Attempting next endpoint for push after error: %v", err)
130130
continue
131131
}
132132
}

0 commit comments

Comments
 (0)