mirror of https://github.com/docker/docs.git
use ID and names
This commit is contained in:
parent
725c03d799
commit
20319a5049
|
|
@ -32,8 +32,8 @@ type handler func(c *context, w http.ResponseWriter, r *http.Request)
|
|||
func getInfo(c *context, w http.ResponseWriter, r *http.Request) {
|
||||
driverStatus := [][2]string{{"\bNodes", fmt.Sprintf("%d", len(c.cluster.Nodes()))}}
|
||||
|
||||
for ID, node := range c.cluster.Nodes() {
|
||||
driverStatus = append(driverStatus, [2]string{ID, node.Addr})
|
||||
for _, node := range c.cluster.Nodes() {
|
||||
driverStatus = append(driverStatus, [2]string{node.Name, node.Addr})
|
||||
}
|
||||
info := struct {
|
||||
Containers int
|
||||
|
|
@ -70,7 +70,7 @@ func getContainersJSON(c *context, w http.ResponseWriter, r *http.Request) {
|
|||
// TODO remove the Node ID in the name when we have a good solution
|
||||
tmp.Names = make([]string, len(container.Names))
|
||||
for i, name := range container.Names {
|
||||
tmp.Names[i] = "/" + container.Node().ID + name
|
||||
tmp.Names[i] = "/" + container.Node().Name + name
|
||||
}
|
||||
tmp.Ports = make([]dockerclient.Port, len(container.Ports))
|
||||
for i, port := range container.Ports {
|
||||
|
|
|
|||
|
|
@ -17,9 +17,8 @@ const (
|
|||
stateRefreshPeriod = 30 * time.Second
|
||||
)
|
||||
|
||||
func NewNode(id string, addr string) *Node {
|
||||
func NewNode(addr string) *Node {
|
||||
e := &Node{
|
||||
ID: id,
|
||||
Addr: addr,
|
||||
Labels: make(map[string]string),
|
||||
ch: make(chan bool),
|
||||
|
|
@ -34,6 +33,7 @@ type Node struct {
|
|||
ID string
|
||||
IP string
|
||||
Addr string
|
||||
Name string
|
||||
Cpus int64
|
||||
Memory int64
|
||||
Labels map[string]string
|
||||
|
|
@ -96,6 +96,8 @@ func (n *Node) updateSpecs() error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
n.ID = info.ID
|
||||
n.Name = info.Name
|
||||
n.Cpus = info.NCPU
|
||||
n.Memory = info.MemTotal
|
||||
n.Labels = map[string]string{
|
||||
|
|
|
|||
Loading…
Reference in New Issue