etcdctl: ignore value in updatedir command

Fixes coreos#4145.
client.KeysAPI ignores value if SetOptions.Dir is true.
release-2.2
Gyu-Ho Lee 2016-01-06 16:34:39 -08:00 committed by Xiang Li
parent e6ffe22e16
commit e340928988
1 changed files with 1 additions and 8 deletions

View File

@ -16,7 +16,6 @@ package command
import (
"errors"
"os"
"time"
"github.com/coreos/etcd/Godeps/_workspace/src/github.com/codegangsta/cli"
@ -43,15 +42,9 @@ func updatedirCommandFunc(c *cli.Context, ki client.KeysAPI) {
handleError(ExitBadArgs, errors.New("key required"))
}
key := c.Args()[0]
value, err := argOrStdin(c.Args(), os.Stdin, 1)
if err != nil {
handleError(ExitBadArgs, errors.New("value required"))
}
ttl := c.Int("ttl")
ctx, cancel := contextWithTotalTimeout(c)
_, err = ki.Set(ctx, key, value, &client.SetOptions{TTL: time.Duration(ttl) * time.Second, Dir: true, PrevExist: client.PrevExist})
_, err := ki.Set(ctx, key, "", &client.SetOptions{TTL: time.Duration(ttl) * time.Second, Dir: true, PrevExist: client.PrevExist})
cancel()
if err != nil {
handleError(ExitServerError, err)