consul: Fixing for upstream API changes

This commit is contained in:
Armon Dadgar 2014-05-01 18:11:30 -07:00
parent 97541402be
commit 888ce89b91
2 changed files with 3 additions and 3 deletions

View File

@ -367,7 +367,7 @@ func (s *Server) joinConsulServer(m serf.Member, parts *serverParts) error {
// Attempt to add as a peer // Attempt to add as a peer
var addr net.Addr = &net.TCPAddr{IP: m.Addr, Port: parts.Port} var addr net.Addr = &net.TCPAddr{IP: m.Addr, Port: parts.Port}
future := s.raft.AddPeer(addr) future := s.raft.AddPeer(addr)
if err := future.Error(); err != nil && err != raft.KnownPeer { if err := future.Error(); err != nil && err != raft.ErrKnownPeer {
s.logger.Printf("[ERR] consul: failed to add raft peer: %v", err) s.logger.Printf("[ERR] consul: failed to add raft peer: %v", err)
return err return err
} }
@ -384,7 +384,7 @@ func (s *Server) removeConsulServer(m serf.Member, port int) error {
// Attempt to remove as peer // Attempt to remove as peer
peer := &net.TCPAddr{IP: m.Addr, Port: port} peer := &net.TCPAddr{IP: m.Addr, Port: port}
future := s.raft.RemovePeer(peer) future := s.raft.RemovePeer(peer)
if err := future.Error(); err != nil && err != raft.UnknownPeer { if err := future.Error(); err != nil && err != raft.ErrUnknownPeer {
s.logger.Printf("[ERR] consul: failed to remove raft peer '%v': %v", s.logger.Printf("[ERR] consul: failed to remove raft peer '%v': %v",
peer, err) peer, err)
return err return err

View File

@ -458,7 +458,7 @@ func (s *Server) Leave() error {
select { select {
case err := <-ch: case err := <-ch:
// Ignore if we have already been deregistered by the leader // Ignore if we have already been deregistered by the leader
if err != nil && err.Error() != raft.UnknownPeer.Error() { if err != nil && err.Error() != raft.ErrUnknownPeer.Error() {
s.logger.Printf("[ERR] consul: failed to leave Raft cluster: %v", err) s.logger.Printf("[ERR] consul: failed to leave Raft cluster: %v", err)
} }
case <-time.After(3 * time.Second): case <-time.After(3 * time.Second):