From 722b0a19c59712d15cbf8e66b87ee2ccd2082b10 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 20 Feb 2017 17:50:31 +0100 Subject: [PATCH] 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 Upstream-commit: 86061441593f8c768781681db2268bc1ab6d043e Component: engine --- components/engine/distribution/pull.go | 2 +- components/engine/distribution/pull_v2.go | 1 - components/engine/distribution/push.go | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/components/engine/distribution/pull.go b/components/engine/distribution/pull.go index 571beaa7ad..c5bdbd6d3b 100644 --- a/components/engine/distribution/pull.go +++ b/components/engine/distribution/pull.go @@ -140,7 +140,7 @@ func Pull(ctx context.Context, ref reference.Named, imagePullConfig *ImagePullCo // append subsequent errors lastErr = err } - logrus.Errorf("Attempting next endpoint for pull after error: %v", err) + logrus.Infof("Attempting next endpoint for pull after error: %v", err) continue } logrus.Errorf("Not continuing with pull after error: %v", err) diff --git a/components/engine/distribution/pull_v2.go b/components/engine/distribution/pull_v2.go index 0188552773..e940cf55a9 100644 --- a/components/engine/distribution/pull_v2.go +++ b/components/engine/distribution/pull_v2.go @@ -73,7 +73,6 @@ func (p *v2Puller) Pull(ctx context.Context, ref reference.Named) (err error) { return err } if continueOnError(err) { - logrus.Errorf("Error trying v2 registry: %v", err) return fallbackError{ err: err, confirmedV2: p.confirmedV2, diff --git a/components/engine/distribution/push.go b/components/engine/distribution/push.go index 9d5328035c..395e4d1512 100644 --- a/components/engine/distribution/push.go +++ b/components/engine/distribution/push.go @@ -126,7 +126,7 @@ func Push(ctx context.Context, ref reference.Named, imagePushConfig *ImagePushCo } err = fallbackErr.err lastErr = err - logrus.Errorf("Attempting next endpoint for push after error: %v", err) + logrus.Infof("Attempting next endpoint for push after error: %v", err) continue } }