mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdctl: don't ask password twice for etcdctl endpoint health --cluster
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 https://github.com/coreos/etcd/issues/9094
This commit is contained in:
parent
c5532ebbf6
commit
b337674971
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user