server,cmd: fix error handling
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
90a446e2a5
commit
713bbabc61
2 changed files with 5 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
|
@ -45,7 +46,7 @@ var runtimeVersionCommand = cli.Command{
|
|||
// Set up a connection to the server.
|
||||
conn, err := grpc.Dial(address, grpc.WithInsecure())
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to connect: %v", err)
|
||||
return fmt.Errorf("Failed to connect: %v", err)
|
||||
}
|
||||
defer conn.Close()
|
||||
client := pb.NewRuntimeServiceClient(conn)
|
||||
|
@ -54,9 +55,8 @@ var runtimeVersionCommand = cli.Command{
|
|||
version := "v1alpha1"
|
||||
err = Version(client, version)
|
||||
if err != nil {
|
||||
log.Fatalf("Getting the runtime version failed: %v", err)
|
||||
return fmt.Errorf("Getting the runtime version failed: %v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
|
|
@ -17,14 +17,14 @@ func (s *Server) Version(ctx context.Context, req *pb.VersionRequest) (*pb.Versi
|
|||
|
||||
version, err := getGPRCVersion()
|
||||
if err != nil {
|
||||
return nil, nil
|
||||
return nil, err
|
||||
}
|
||||
|
||||
runtimeName := "runc"
|
||||
|
||||
runtimeVersion, err := execRuncVersion("runc", "-v")
|
||||
if err != nil {
|
||||
return nil, nil
|
||||
return nil, err
|
||||
}
|
||||
|
||||
runtimeApiVersion := "v1alpha1"
|
||||
|
|
Loading…
Reference in a new issue