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

fix(1488): suppress gRPC logs and errors
pull/1483/merge
Matt Butcher 8 years ago committed by GitHub
commit 6b222cdc0f

@ -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

Loading…
Cancel
Save