From 85f7ebfb48dc8f098dfcd0395d3f4763376be09a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20J=2E=20=C5=81akis?= Date: Tue, 8 Nov 2016 17:38:39 +0100 Subject: [PATCH] version: Fix parsing for gRPC version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jacek J. Łakis --- server/utils.go | 23 ----------------------- server/version.go | 6 +----- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/server/utils.go b/server/utils.go index 190f66f9..812b1810 100644 --- a/server/utils.go +++ b/server/utils.go @@ -1,15 +1,10 @@ package server import ( - "errors" "fmt" "io" "os" - "path/filepath" - "runtime" "strings" - - "github.com/kubernetes-incubator/cri-o/utils" ) const ( @@ -30,24 +25,6 @@ func sPtr(s string) *string { return &s } -func getGPRCVersion() (string, error) { - _, file, _, ok := runtime.Caller(0) - if !ok { - return "", errors.New("failed to recover the caller information") - } - - ocidRoot := filepath.Dir(filepath.Dir(file)) - p := filepath.Join(ocidRoot, "Godeps/Godeps.json") - - grepCmd := fmt.Sprintf(`grep -r "\"google.golang.org/grpc\"" %s -A 1 | grep "\"Rev\"" | cut -d: -f2 | tr -d ' "\n'`, p) - - out, err := utils.ExecCmd("bash", "-c", grepCmd) - if err != nil { - return "", err - } - return out, nil -} - func copyFile(src, dest string) error { in, err := os.Open(src) if err != nil { diff --git a/server/version.go b/server/version.go index 69b5999b..56c990fd 100644 --- a/server/version.go +++ b/server/version.go @@ -7,10 +7,6 @@ import ( // Version returns the runtime name, runtime version and runtime API version func (s *Server) Version(ctx context.Context, req *pb.VersionRequest) (*pb.VersionResponse, error) { - version, err := getGPRCVersion() - if err != nil { - return nil, err - } runtimeVersion, err := s.runtime.Version() if err != nil { @@ -18,7 +14,7 @@ func (s *Server) Version(ctx context.Context, req *pb.VersionRequest) (*pb.Versi } // TODO: Track upstream code. For now it expects 0.1.0 - version = "0.1.0" + version := "0.1.0" // taking const address rav := runtimeAPIVersion