consul: Do not override the node address

This commit is contained in:
Armon Dadgar 2015-01-08 10:57:15 -08:00
parent 419447d9f7
commit 779ae5ca0d
1 changed files with 6 additions and 10 deletions

View File

@ -832,17 +832,13 @@ func (s *StateStore) parseServiceNodes(tx *MDBTxn, table *MDBTable, res []interf
for i, r := range res { for i, r := range res {
srv := r.(*structs.ServiceNode) srv := r.(*structs.ServiceNode)
if srv.ServiceAddress != "" { // Get the address of the node
srv.Address = srv.ServiceAddress nodeRes, err := table.GetTxn(tx, "id", srv.Node)
} else { if err != nil || len(nodeRes) != 1 {
// Get the address of the node s.logger.Printf("[ERR] consul.state: Failed to join service node %#v with node: %v", *srv, err)
nodeRes, err := table.GetTxn(tx, "id", srv.Node) continue
if err != nil || len(nodeRes) != 1 {
s.logger.Printf("[ERR] consul.state: Failed to join service node %#v with node: %v", *srv, err)
continue
}
srv.Address = nodeRes[0].(*structs.Node).Address
} }
srv.Address = nodeRes[0].(*structs.Node).Address
nodes[i] = *srv nodes[i] = *srv
} }