Skip to content

Commit fa63dcb

Browse files
committed
Don't mention internal error when docker registry is unreachable
Should make oc new-app output less scary when used in disconnected environment. Before: $ oc new-app somegitrepo ...dockerimagelookup.go:220] Docker registry lookup failed: Internal error occurred: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) After: $ oc new-app somegitrepo ...dockerimagelookup.go:220] Docker registry lookup failed: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) Fixes bug 1398330.
1 parent 04e71ca commit fa63dcb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/generate/app/dockerimagelookup.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,14 @@ func (s ImageImportSearcher) Search(precise bool, terms ...string) (ComponentMat
214214
glog.V(4).Infof("image import failed: %#v", image)
215215
switch image.Status.Reason {
216216
case unversioned.StatusReasonInternalError:
217-
glog.Warningf("Docker registry lookup failed: %s", image.Status.Message)
217+
// try to find the cause of the internal error
218+
if image.Status.Details != nil && len(image.Status.Details.Causes) > 0 {
219+
for _, c := range image.Status.Details.Causes {
220+
glog.Warningf("Docker registry lookup failed: %s", c.Message)
221+
}
222+
} else {
223+
glog.Warningf("Docker registry lookup failed: %s", image.Status.Message)
224+
}
218225
case unversioned.StatusReasonInvalid, unversioned.StatusReasonUnauthorized, unversioned.StatusReasonNotFound:
219226
default:
220227
errs = append(errs, fmt.Errorf("can't look up Docker image %q: %s", term, image.Status.Message))

0 commit comments

Comments
 (0)