From 8d87ae3fdf7d5c9d573e0578cb0b9b5ea089f360 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 c35124c510c..0fccdda641c 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) }