From b4a9d77d493eebb2903a1612ac20e5e467597969 Mon Sep 17 00:00:00 2001 From: Preetha Appan Date: Tue, 29 Aug 2017 14:12:32 -0500 Subject: [PATCH] ServerAddressProvider interface also returns an error now --- agent/consul/server.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/agent/consul/server.go b/agent/consul/server.go index 1fc739d64..ba11ace03 100644 --- a/agent/consul/server.go +++ b/agent/consul/server.go @@ -1049,16 +1049,15 @@ func (s *Server) GetWANCoordinate() (*coordinate.Coordinate, error) { return s.serfWAN.GetCoordinate() } -func (s *Server) ServerAddr(id raft.ServerID) raft.ServerAddress { +func (s *Server) ServerAddr(id raft.ServerID) (raft.ServerAddress, error) { if string(id) == string(s.config.NodeID) { - return raft.ServerAddress(s.config.RPCAddr.String()) + return raft.ServerAddress(s.config.RPCAddr.String()), nil } addr, err := s.router.GetServerAddressByID(s.config.Datacenter, string(id)) if err != nil { - s.logger.Println("[WARN] Unable to find address for raft server id %v", id) - return raft.ServerAddress("") + return "", err } - return raft.ServerAddress(addr) + return raft.ServerAddress(addr), nil } // Atomically sets a readiness state flag when leadership is obtained, to indicate that server is past its barrier write