version: Fix parsing for gRPC version

Signed-off-by: Jacek J. Łakis <jacek.lakis@intel.com>
This commit is contained in:
Jacek J. Łakis 2016-11-08 17:38:39 +01:00
parent 8d275cebb9
commit 85f7ebfb48
2 changed files with 1 additions and 28 deletions

View file

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