Commit 998f3327 authored by Davanum Srinivas's avatar Davanum Srinivas

Better error check for kubectl cluster-info

In RunClusterInfo, We try to connect to the api service and get some information, but we just ignore the errors from Do().Visit(). We should return the error returned by Do().Visit() so the "kubectl cluster-info" would fail correctly with an error code.
parent 6f06408e
...@@ -77,7 +77,7 @@ func RunClusterInfo(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) error ...@@ -77,7 +77,7 @@ func RunClusterInfo(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) error
SelectorParam("kubernetes.io/cluster-service=true"). SelectorParam("kubernetes.io/cluster-service=true").
ResourceTypeOrNameArgs(false, []string{"services"}...). ResourceTypeOrNameArgs(false, []string{"services"}...).
Latest() Latest()
b.Do().Visit(func(r *resource.Info, err error) error { err = b.Do().Visit(func(r *resource.Info, err error) error {
if err != nil { if err != nil {
return err return err
} }
...@@ -125,7 +125,7 @@ func RunClusterInfo(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) error ...@@ -125,7 +125,7 @@ func RunClusterInfo(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) error
return nil return nil
}) })
out.Write([]byte("\nTo further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.\n")) out.Write([]byte("\nTo further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.\n"))
return nil return err
// TODO consider printing more information about cluster // TODO consider printing more information about cluster
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment