Skip to content

Commit

Permalink
etcdctl: allow move-leader to connect to multiple endpoints with TLS
Browse files Browse the repository at this point in the history
The mustClientForCmd function is responsible for parsing environment
variables and flags into configuration data. A change was made in etcd-io#9382 to call Fatal if a flag is provided multiple times.
This means that we cannot call the mustClientForCmd function more than
once, since it will think that flags parsed the first time are now being
redefined and error out.
  • Loading branch information
Ben Moss committed Apr 9, 2020
1 parent 7eae024 commit 561b3bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions etcdctl/ctlv3/command/move_leader_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ func transferLeadershipCommandFunc(cmd *cobra.Command, args []string) {
ExitWithError(ExitBadArgs, err)
}

c := mustClientFromCmd(cmd)
cfg := clientConfigFromCmd(cmd)
c := cfg.mustClient()
eps := c.Endpoints()
c.Close()

Expand All @@ -52,7 +53,6 @@ func transferLeadershipCommandFunc(cmd *cobra.Command, args []string) {
var leaderCli *clientv3.Client
var leaderID uint64
for _, ep := range eps {
cfg := clientConfigFromCmd(cmd)
cfg.endpoints = []string{ep}
cli := cfg.mustClient()
resp, serr := cli.Status(ctx, ep)
Expand Down

0 comments on commit 561b3bd

Please sign in to comment.