Skip to content

Commit

Permalink
etcdctl: don't ask password twice for etcdctl endpoint health --cluster
Browse files Browse the repository at this point in the history
Current etcdctl endpoint health --cluster asks password twice if auth
is enabled. This is because the command creates two client instances:
one for the purpose of checking endpoint health and another for
getting cluster members with MemberList(). The latter client doesn't
need to be authenticated because MemberList() is a public RPC. This
commit makes the client with no authed one.

Fix #9094
  • Loading branch information
mitake authored and gyuho committed Jan 12, 2018
1 parent 9ccae0f commit 6178c45
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion etcdctl/ctlv3/command/ep_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,26 @@ func endpointsFromCluster(cmd *cobra.Command) []string {
}
return endpoints
}
c := mustClientFromCmd(cmd)

sec := secureCfgFromCmd(cmd)
dt := dialTimeoutFromCmd(cmd)
ka := keepAliveTimeFromCmd(cmd)
kat := keepAliveTimeoutFromCmd(cmd)
eps, err := endpointsFromCmd(cmd)
if err != nil {
ExitWithError(ExitError, err)
}
// exclude auth for not asking needless password (MemberList() doesn't need authentication)

cfg, err := newClientCfg(eps, dt, ka, kat, sec, nil)
if err != nil {
ExitWithError(ExitError, err)
}
c, err := v3.New(*cfg)
if err != nil {
ExitWithError(ExitError, err)
}

ctx, cancel := commandCtx(cmd)
defer func() {
c.Close()
Expand Down

0 comments on commit 6178c45

Please sign in to comment.