Fix ctr cri timeout.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2018-06-05 00:04:47 +00:00
parent ecf8d99d06
commit 0faff1c22f
3 changed files with 9 additions and 9 deletions

View File

@@ -49,16 +49,16 @@ var loadCommand = cli.Command{
timeout = context.GlobalDuration("timeout")
cancel gocontext.CancelFunc
)
cl, err := client.NewCRIPluginClient(address, timeout)
if err != nil {
return errors.Wrap(err, "failed to create grpc client")
}
if timeout > 0 {
ctx, cancel = gocontext.WithTimeout(gocontext.Background(), timeout)
} else {
ctx, cancel = gocontext.WithCancel(ctx)
}
defer cancel()
cl, err := client.NewCRIPluginClient(ctx, address)
if err != nil {
return errors.Wrap(err, "failed to create grpc client")
}
for _, path := range context.Args() {
absPath, err := filepath.Abs(path)
if err != nil {