etcdctl: respect --write-out=json for endpoint status command

This commit is contained in:
Anthony Romano 2016-04-13 17:04:31 -07:00
parent e9aa8ff235
commit f07350735d
2 changed files with 10 additions and 10 deletions

View File

@ -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)

View File

@ -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),
})
}