diff --git a/CHANGELOG.md b/CHANGELOG.md index c70e83fec..61f9e0e12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ ziti edge create service test --terminator-strategy sticky * github.com/openziti/storage: [v0.2.37 -> v0.2.41](https://github.com/openziti/storage/compare/v0.2.37...v0.2.41) * github.com/openziti/transport/v2: [v2.0.131 -> v2.0.133](https://github.com/openziti/transport/compare/v2.0.131...v2.0.133) * github.com/openziti/ziti: [v1.1.2 -> v1.1.3](https://github.com/openziti/ziti/compare/v1.1.2...v1.1.3) + * [Issue #2055](https://github.com/openziti/ziti/issues/2055) - Controller panics on 'ziti agent cluster list' * [Issue #2019](https://github.com/openziti/ziti/issues/2019) - Support mechanism for sticky dials # Release 1.1.2 diff --git a/controller/agent.go b/controller/agent.go index 34e3c4a40..2b26dc504 100644 --- a/controller/agent.go +++ b/controller/agent.go @@ -77,6 +77,11 @@ func (self *Controller) agentOpSnapshotDb(m *channel.Message, ch channel.Channel } func (self *Controller) agentOpRaftList(m *channel.Message, ch channel.Channel) { + if self.raftController == nil { + handler_common.SendOpResult(m, ch, "raft.list", "controller not running in clustered mode", false) + return + } + members, err := self.raftController.ListMembers() if err != nil { handler_common.SendOpResult(m, ch, "raft.list", err.Error(), false) @@ -100,6 +105,11 @@ func (self *Controller) agentOpRaftList(m *channel.Message, ch channel.Channel) } func (self *Controller) agentOpRaftAddPeer(m *channel.Message, ch channel.Channel) { + if self.raftController == nil { + handler_common.SendOpResult(m, ch, "raft.list", "controller not running in clustered mode", false) + return + } + addr, found := m.GetStringHeader(AgentAddrHeader) if !found { handler_common.SendOpResult(m, ch, "raft.join", "address not supplied", false) @@ -137,6 +147,11 @@ func (self *Controller) agentOpRaftAddPeer(m *channel.Message, ch channel.Channe } func (self *Controller) agentOpRaftRemovePeer(m *channel.Message, ch channel.Channel) { + if self.raftController == nil { + handler_common.SendOpResult(m, ch, "raft.list", "controller not running in clustered mode", false) + return + } + id, found := m.GetStringHeader(AgentIdHeader) if !found { handler_common.SendOpResult(m, ch, "cluster.remove-peer", "id not supplied", false) @@ -155,6 +170,11 @@ func (self *Controller) agentOpRaftRemovePeer(m *channel.Message, ch channel.Cha } func (self *Controller) agentOpRaftTransferLeadership(m *channel.Message, ch channel.Channel) { + if self.raftController == nil { + handler_common.SendOpResult(m, ch, "raft.list", "controller not running in clustered mode", false) + return + } + id, _ := m.GetStringHeader(AgentIdHeader) req := &cmd_pb.TransferLeadershipRequest{ Id: id, @@ -168,6 +188,11 @@ func (self *Controller) agentOpRaftTransferLeadership(m *channel.Message, ch cha } func (self *Controller) agentOpInitFromDb(m *channel.Message, ch channel.Channel) { + if self.raftController == nil { + handler_common.SendOpResult(m, ch, "raft.list", "controller not running in clustered mode", false) + return + } + sourceDbPath := string(m.Body) if len(sourceDbPath) == 0 { handler_common.SendOpResult(m, ch, "raft.initFromDb", "source db not supplied", false)