Merge pull request #24159 from yongtang/24090-docker-node-list-hostname
Use HOSTNAME in the output of `docker node ls` Upstream-commit: 0f687aafafb1b3f3503e71e6a04e766cc85f4372 Component: engine
This commit is contained in:
@ -74,16 +74,12 @@ func printTable(out io.Writer, nodes []swarm.Node, info types.Info) {
|
||||
// Ignore flushing errors
|
||||
defer writer.Flush()
|
||||
|
||||
fmt.Fprintf(writer, listItemFmt, "ID", "NAME", "MEMBERSHIP", "STATUS", "AVAILABILITY", "MANAGER STATUS")
|
||||
fmt.Fprintf(writer, listItemFmt, "ID", "HOSTNAME", "MEMBERSHIP", "STATUS", "AVAILABILITY", "MANAGER STATUS")
|
||||
for _, node := range nodes {
|
||||
name := node.Spec.Name
|
||||
name := node.Description.Hostname
|
||||
availability := string(node.Spec.Availability)
|
||||
membership := string(node.Spec.Membership)
|
||||
|
||||
if name == "" {
|
||||
name = node.Description.Hostname
|
||||
}
|
||||
|
||||
reachability := ""
|
||||
if node.ManagerStatus != nil {
|
||||
if node.ManagerStatus.Leader {
|
||||
|
||||
Reference in New Issue
Block a user