mirror of https://github.com/docker/docs.git
report error when two Docker's IDs are duplicated
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
This commit is contained in:
parent
d27e8a35a1
commit
5f6a257e0c
|
@ -48,7 +48,11 @@ func (c *Cluster) AddNode(n *Node) error {
|
|||
c.Lock()
|
||||
defer c.Unlock()
|
||||
|
||||
if _, exists := c.nodes[n.ID]; exists {
|
||||
if old, exists := c.nodes[n.ID]; exists {
|
||||
if old.IP != n.IP {
|
||||
log.Errorf("ID duplicated: %s", n.ID)
|
||||
log.Errorf("IP [%s] and [%s] share the same ID", old.IP, n.IP)
|
||||
}
|
||||
return ErrNodeAlreadyRegistered
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue