From b757772ebc2e8c32564aa4c5286b4e166b005e81 Mon Sep 17 00:00:00 2001 From: Benjamin Wang Date: Tue, 15 Oct 2024 14:06:16 +0100 Subject: [PATCH] Update endpointsFromCluster to reuse clientConfigFromCmd Signed-off-by: Benjamin Wang --- etcdctl/ctlv3/command/ep_command.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/etcdctl/ctlv3/command/ep_command.go b/etcdctl/ctlv3/command/ep_command.go index 501253c67d6..a5ee32989a9 100644 --- a/etcdctl/ctlv3/command/ep_command.go +++ b/etcdctl/ctlv3/command/ep_command.go @@ -251,23 +251,10 @@ func endpointsFromCluster(cmd *cobra.Command) []string { return endpoints } - sec := secureCfgFromCmd(cmd) - dt := dialTimeoutFromCmd(cmd) - ka := keepAliveTimeFromCmd(cmd) - kat := keepAliveTimeoutFromCmd(cmd) - eps, err := endpointsFromCmd(cmd) - if err != nil { - cobrautl.ExitWithError(cobrautl.ExitError, err) - } + cfgSpec := clientConfigFromCmd(cmd) // exclude auth for not asking needless password (MemberList() doesn't need authentication) lg, _ := logutil.CreateDefaultZapLogger(zap.InfoLevel) - cfg, err := clientv3.NewClientConfig(&clientv3.ConfigSpec{ - Endpoints: eps, - DialTimeout: dt, - KeepAliveTime: ka, - KeepAliveTimeout: kat, - Secure: sec, - }, lg) + cfg, err := clientv3.NewClientConfig(cfgSpec, lg) if err != nil { cobrautl.ExitWithError(cobrautl.ExitError, err) }