From 7b7d8ccb771a4f903e9b0ac252cb643e1eea7201 Mon Sep 17 00:00:00 2001 From: Mike Danese Date: Fri, 5 Jun 2015 18:08:55 -0700 Subject: [PATCH] print various errors which is useful when ContinueOnError is set on the Resource struct --- pkg/kubectl/resource/visitor.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/kubectl/resource/visitor.go b/pkg/kubectl/resource/visitor.go index 953564da3ad..63e77980150 100644 --- a/pkg/kubectl/resource/visitor.go +++ b/pkg/kubectl/resource/visitor.go @@ -37,6 +37,8 @@ import ( ) // Visitor lets clients walk a list of resources. +// TODO: we should rethink how we handle errors in the visit loop +// (See https://github.com/GoogleCloudPlatform/kubernetes/pull/9357#issuecomment-109600305) type Visitor interface { Visit(VisitorFunc) error } @@ -220,7 +222,7 @@ func (v *PathVisitor) Visit(fn VisitorFunc) error { if !v.IgnoreErrors { return err } - glog.V(2).Infof("Unable to load file %q: %v", v.Path, err) + fmt.Fprintf(os.Stderr, "error: unable to load file %q: %v\n", v.Path, err) return nil } return fn(info) @@ -283,7 +285,7 @@ func (v *DirectoryVisitor) Visit(fn VisitorFunc) error { if !v.IgnoreErrors { return err } - glog.V(2).Infof("Unable to load file %q: %v", path, err) + fmt.Fprintf(os.Stderr, "error: unable to load file %q: %v\n", path, err) return nil } return fn(info) @@ -471,7 +473,7 @@ func (v *StreamVisitor) Visit(fn VisitorFunc) error { info, err := v.InfoForData(ext.RawJSON, v.Source) if err != nil { if v.IgnoreErrors { - glog.Warningf("Could not read an encoded object from %s: %v", v.Source, err) + fmt.Fprintf(os.Stderr, "error: could not read an encoded object from %s: %v\n", v.Source, err) glog.V(4).Infof("Unreadable: %s", string(ext.RawJSON)) continue }