Commit 6b222cdc authored by Matt Butcher's avatar Matt Butcher Committed by GitHub

Merge pull request #1490 from technosophos/fix/1488-shorter-errors

fix(1488): suppress gRPC logs and errors
parents 13ec13af 32354be0
......@@ -20,11 +20,14 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"strings"
"github.com/spf13/cobra"
"google.golang.org/grpc"
"google.golang.org/grpc/grpclog"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/client/unversioned"
......@@ -90,6 +93,9 @@ func newRootCmd(out io.Writer) *cobra.Command {
p.StringVar(&kubeContext, "kube-context", "", "name of the kubeconfig context to use")
p.BoolVarP(&flagDebug, "debug", "", false, "enable verbose output")
// Tell gRPC not to log to console.
grpclog.SetLogger(log.New(ioutil.Discard, "", log.LstdFlags))
rup := newRepoUpdateCmd(out)
rup.Deprecated = "use 'helm repo update'\n"
......
......@@ -20,6 +20,7 @@ import (
"errors"
"fmt"
"io"
"os"
"github.com/spf13/cobra"
"google.golang.org/grpc"
......@@ -101,7 +102,10 @@ func (v *versionCmd) run() error {
if grpc.Code(err) == codes.Unimplemented {
return errors.New("server is too old to know its version")
}
return err
if flagDebug {
fmt.Fprintln(os.Stderr, err)
}
return errors.New("cannot connect to Tiller")
}
fmt.Fprintf(v.out, "Server: %#v\n", resp.Version)
return nil
......
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