From 8e040efed995ca08466c8bec695c99004833ad9a Mon Sep 17 00:00:00 2001 From: Yicheng Qin Date: Wed, 2 Sep 2015 14:52:31 -0700 Subject: [PATCH] etcdctl: log more about sync process Users don't even know that etcdctl is doing sync and fails on sync process. So we add more logs for sync process. --- etcdctl/command/util.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/etcdctl/command/util.go b/etcdctl/command/util.go index b8f329873..0e9b51558 100644 --- a/etcdctl/command/util.go +++ b/etcdctl/command/util.go @@ -187,7 +187,15 @@ func mustNewClient(c *cli.Context) client.Client { os.Exit(1) } + debug := c.GlobalBool("debug") + if debug { + client.EnablecURLDebug() + } + if !c.GlobalBool("no-sync") { + if debug { + fmt.Fprintf(os.Stderr, "start to sync cluster using endpoints(%s)\n", strings.Join(hc.Endpoints(), ",")) + } ctx, cancel := context.WithTimeout(context.Background(), client.DefaultRequestTimeout) err := hc.Sync(ctx) cancel() @@ -199,11 +207,13 @@ func mustNewClient(c *cli.Context) client.Client { handleError(ExitServerError, err) os.Exit(1) } + if debug { + fmt.Fprintf(os.Stderr, "got endpoints(%s) after sync\n", strings.Join(hc.Endpoints(), ",")) + } } - if c.GlobalBool("debug") { + if debug { fmt.Fprintf(os.Stderr, "Cluster-Endpoints: %s\n", strings.Join(hc.Endpoints(), ", ")) - client.EnablecURLDebug() } return hc