mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdctl: respect --write-out=json for endpoint status command
This commit is contained in:
parent
e9aa8ff235
commit
f07350735d
@ -104,8 +104,8 @@ func epHealthCommandFunc(cmd *cobra.Command, args []string) {
|
||||
}
|
||||
|
||||
type epStatus struct {
|
||||
ep string
|
||||
resp *v3.StatusResponse
|
||||
Ep string `json:"Endpoint"`
|
||||
Resp *v3.StatusResponse `json:"Status"`
|
||||
}
|
||||
|
||||
func epStatusCommandFunc(cmd *cobra.Command, args []string) {
|
||||
@ -122,7 +122,7 @@ func epStatusCommandFunc(cmd *cobra.Command, args []string) {
|
||||
fmt.Fprintf(os.Stderr, "Failed to get the status of endpoint %s (%v)\n", ep, serr)
|
||||
continue
|
||||
}
|
||||
statusList = append(statusList, epStatus{ep: ep, resp: resp})
|
||||
statusList = append(statusList, epStatus{Ep: ep, Resp: resp})
|
||||
}
|
||||
|
||||
display.EndpointStatus(statusList)
|
||||
|
@ -134,13 +134,13 @@ func (s *simplePrinter) EndpointStatus(statusList []epStatus) {
|
||||
|
||||
for _, status := range statusList {
|
||||
table.Append([]string{
|
||||
fmt.Sprint(status.ep),
|
||||
fmt.Sprintf("%x", status.resp.Header.MemberId),
|
||||
fmt.Sprint(status.resp.Version),
|
||||
fmt.Sprint(humanize.Bytes(uint64(status.resp.DbSize))),
|
||||
fmt.Sprint(status.resp.Leader == status.resp.Header.MemberId),
|
||||
fmt.Sprint(status.resp.RaftTerm),
|
||||
fmt.Sprint(status.resp.RaftIndex),
|
||||
fmt.Sprint(status.Ep),
|
||||
fmt.Sprintf("%x", status.Resp.Header.MemberId),
|
||||
fmt.Sprint(status.Resp.Version),
|
||||
fmt.Sprint(humanize.Bytes(uint64(status.Resp.DbSize))),
|
||||
fmt.Sprint(status.Resp.Leader == status.Resp.Header.MemberId),
|
||||
fmt.Sprint(status.Resp.RaftTerm),
|
||||
fmt.Sprint(status.Resp.RaftIndex),
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user