From 3fef02aa939cc28cfaf3ac912a5bbe490b9205d0 Mon Sep 17 00:00:00 2001 From: Hemanth Basappa Date: Mon, 29 Apr 2019 16:38:27 -0700 Subject: [PATCH] Add support in nomad for supporting raft 3 protocol peers.json --- nomad/server.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nomad/server.go b/nomad/server.go index c35124c51..0fccdda64 100644 --- a/nomad/server.go +++ b/nomad/server.go @@ -1169,7 +1169,12 @@ func (s *Server) setupRaft() error { } } else if _, err := os.Stat(peersFile); err == nil { s.logger.Info("found peers.json file, recovering Raft configuration...") - configuration, err := raft.ReadPeersJSON(peersFile) + var configuration raft.Configuration + if s.config.RaftConfig.ProtocolVersion < 3 { + configuration, err = raft.ReadPeersJSON(peersFile) + } else { + configuration, err = raft.ReadConfigJSON(peersFile) + } if err != nil { return fmt.Errorf("recovery failed to parse peers.json: %v", err) }