etcdctl: use user specified timeout value for entire command execution
etcdctl should be capable to use a user specified timeout value for total command execution, not only per request timeout. This commit adds a new option --total-timeout to the command. The value passed via this option is used as a timeout value of entire command execution. Fixes coreos#3517
This commit is contained in:
@ -20,7 +20,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/coreos/etcd/Godeps/_workspace/src/github.com/codegangsta/cli"
|
||||
"github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context"
|
||||
"github.com/coreos/etcd/client"
|
||||
)
|
||||
|
||||
@ -67,7 +66,7 @@ func authEnableDisable(c *cli.Context, enable bool) {
|
||||
os.Exit(1)
|
||||
}
|
||||
s := mustNewAuthAPI(c)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), client.DefaultRequestTimeout)
|
||||
ctx, cancel := contextWithTotalTimeout(c)
|
||||
var err error
|
||||
if enable {
|
||||
err = s.Enable(ctx)
|
||||
|
Reference in New Issue
Block a user