sort driver output

This commit is contained in:
Alex Dadgar 2018-03-23 10:59:18 -07:00
parent 5f0c382021
commit 98d3e8a1a7

View file

@ -396,7 +396,14 @@ func (c *NodeStatusCommand) outputNodeDriverInfo(node *api.Node) {
nodeDrivers = append(nodeDrivers, "Driver|Detected|Healthy")
}
for driver, info := range node.Drivers {
drivers := make([]string, 0, len(node.Drivers))
for driver := range node.Drivers {
drivers = append(drivers, driver)
}
sort.Strings(drivers)
for _, driver := range drivers {
info := node.Drivers[driver]
if c.verbose {
timestamp := formatTime(info.UpdateTime)
nodeDrivers = append(nodeDrivers, fmt.Sprintf("%s|%v|%v|%s|%s", driver, info.Detected, info.Healthy, info.HealthDescription, timestamp))