From 11f49a09605b7590fe1b3e7892ff8cc3c66dbe71 Mon Sep 17 00:00:00 2001 From: Hitoshi Mitake Date: Fri, 20 Nov 2015 14:09:50 +0900 Subject: [PATCH] etcdctl: a new option for quorum get Current etcdctl seems to lack an option for specifying quorum flag for GET. This commit adds the option. --- etcdctl/command/get_command.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/etcdctl/command/get_command.go b/etcdctl/command/get_command.go index 7f1f1f933..484d087c7 100644 --- a/etcdctl/command/get_command.go +++ b/etcdctl/command/get_command.go @@ -30,6 +30,7 @@ func NewGetCommand() cli.Command { Usage: "retrieve the value of a key", Flags: []cli.Flag{ cli.BoolFlag{Name: "sort", Usage: "returns result in sorted order"}, + cli.BoolFlag{Name: "quorum", Usage: "require quorum for get request"}, }, Action: func(c *cli.Context) { getCommandFunc(c, mustNewKeyAPI(c)) @@ -45,9 +46,10 @@ func getCommandFunc(c *cli.Context, ki client.KeysAPI) { key := c.Args()[0] sorted := c.Bool("sort") + quorum := c.Bool("quorum") ctx, cancel := contextWithTotalTimeout(c) - resp, err := ki.Get(ctx, key, &client.GetOptions{Sort: sorted}) + resp, err := ki.Get(ctx, key, &client.GetOptions{Sort: sorted, Quorum: quorum}) cancel() if err != nil { handleError(ExitServerError, err)