Merge pull request #218 from chanwit/check-dup-id

Proposal: report error when two Docker's IDs are duplicated
This commit is contained in:
Victor Vieux 2015-01-06 17:58:21 -08:00
commit 9c5896f65c
1 changed files with 4 additions and 1 deletions

View File

@ -48,7 +48,10 @@ func (c *Cluster) AddNode(n *Node) error {
c.Lock() c.Lock()
defer c.Unlock() 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 shared by %s and %s", n.ID, old.IP, n.IP)
}
return ErrNodeAlreadyRegistered return ErrNodeAlreadyRegistered
} }