Skip to content

Commit

Permalink
cmd/etcd-utils: fix list panic
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <[email protected]>
  • Loading branch information
gyuho committed May 8, 2020
1 parent d71b5d2 commit 572b1cb
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions cmd/etcd-utils/k8s/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,18 @@ func listFunc(cmd *cobra.Command, args []string) {
}

var e etcd_client.Etcd
e, err = etcd_client.New(etcd_client.Config{
Logger: lg,
EtcdClientConfig: clientv3.Config{LogConfig: &lcfg, Endpoints: endpoints},
})
if err != nil {
lg.Fatal("failed to create etcd instance")
}
defer func() {
e.Close()
}()

if listLeadershipElection {
e, err = etcd_client.New(etcd_client.Config{
Logger: lg,
EtcdClientConfig: clientv3.Config{LogConfig: &lcfg, Endpoints: endpoints},
})
if err != nil {
lg.Fatal("failed to create etcd instance")
}
defer func() {
e.Close()
}()
ok, err := e.Campaign(listElectionPfx, listElectionTimeout)
if err != nil {
lg.Fatal("failed to campaign")
Expand Down

0 comments on commit 572b1cb

Please sign in to comment.