Browse Source

Remove the node leader column, show leader as status.

Removes the leader column from node ls and shows whether a node is the
leader in the manager status column instead.

Signed-off-by: Drew Erny <drew.erny@docker.com>
(cherry picked from commit 4104c1dc131b62c033c702719909815fba679774)
Drew Erny 9 years ago
parent
commit
c816f2c905
1 changed files with 8 additions and 10 deletions
  1. 8 10
      api/client/node/list.go

+ 8 - 10
api/client/node/list.go

@@ -16,7 +16,7 @@ import (
 )
 )
 
 
 const (
 const (
-	listItemFmt = "%s\t%s\t%s\t%s\t%s\t%s\t%s\n"
+	listItemFmt = "%s\t%s\t%s\t%s\t%s\t%s\n"
 )
 )
 
 
 type listOptions struct {
 type listOptions struct {
@@ -74,7 +74,7 @@ func printTable(out io.Writer, nodes []swarm.Node, info types.Info) {
 	// Ignore flushing errors
 	// Ignore flushing errors
 	defer writer.Flush()
 	defer writer.Flush()
 
 
-	fmt.Fprintf(writer, listItemFmt, "ID", "NAME", "MEMBERSHIP", "STATUS", "AVAILABILITY", "MANAGER STATUS", "LEADER")
+	fmt.Fprintf(writer, listItemFmt, "ID", "NAME", "MEMBERSHIP", "STATUS", "AVAILABILITY", "MANAGER STATUS")
 	for _, node := range nodes {
 	for _, node := range nodes {
 		name := node.Spec.Name
 		name := node.Spec.Name
 		availability := string(node.Spec.Availability)
 		availability := string(node.Spec.Availability)
@@ -84,14 +84,13 @@ func printTable(out io.Writer, nodes []swarm.Node, info types.Info) {
 			name = node.Description.Hostname
 			name = node.Description.Hostname
 		}
 		}
 
 
-		leader := ""
-		if node.ManagerStatus != nil && node.ManagerStatus.Leader {
-			leader = "Yes"
-		}
-
 		reachability := ""
 		reachability := ""
 		if node.ManagerStatus != nil {
 		if node.ManagerStatus != nil {
-			reachability = string(node.ManagerStatus.Reachability)
+			if node.ManagerStatus.Leader {
+				reachability = "Leader"
+			} else {
+				reachability = string(node.ManagerStatus.Reachability)
+			}
 		}
 		}
 
 
 		ID := node.ID
 		ID := node.ID
@@ -107,8 +106,7 @@ func printTable(out io.Writer, nodes []swarm.Node, info types.Info) {
 			client.PrettyPrint(membership),
 			client.PrettyPrint(membership),
 			client.PrettyPrint(string(node.Status.State)),
 			client.PrettyPrint(string(node.Status.State)),
 			client.PrettyPrint(availability),
 			client.PrettyPrint(availability),
-			client.PrettyPrint(reachability),
-			leader)
+			client.PrettyPrint(reachability))
 	}
 	}
 }
 }