From 5e4db081f7a5098c091cb010d16c9aab3bc58ac0 Mon Sep 17 00:00:00 2001 From: James Phillips Date: Tue, 30 Aug 2016 14:59:16 -0700 Subject: [PATCH] Removes Raft types from public API interface. This will cause a lot of breakage because we've currently vendored a branch of the Raft library. --- api/operator.go | 10 +++------- command/operator.go | 4 +--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/api/operator.go b/api/operator.go index b39a015be..48d74f3ca 100644 --- a/api/operator.go +++ b/api/operator.go @@ -1,9 +1,5 @@ package api -import ( - "github.com/hashicorp/raft" -) - // Operator can be used to perform low-level operator tasks for Consul. type Operator struct { c *Client @@ -19,14 +15,14 @@ type RaftServer struct { // ID is the unique ID for the server. These are currently the same // as the address, but they will be changed to a real GUID in a future // release of Consul. - ID raft.ServerID + ID string // Node is the node name of the server, as known by Consul, or this // will be set to "(unknown)" otherwise. Node string // Address is the IP:port of the server, used for Raft communications. - Address raft.ServerAddress + Address string // Leader is true if this server is the current cluster leader. Leader bool @@ -67,7 +63,7 @@ func (op *Operator) RaftGetConfiguration(q *QueryOptions) (*RaftConfiguration, e // RaftRemovePeerByAddress is used to kick a stale peer (one that it in the Raft // quorum but no longer known to Serf or the catalog) by address in the form of // "IP:port". -func (op *Operator) RaftRemovePeerByAddress(address raft.ServerAddress, q *WriteOptions) error { +func (op *Operator) RaftRemovePeerByAddress(address string, q *WriteOptions) error { r := op.c.newRequest("DELETE", "/v1/operator/raft/peer") r.setWriteOptions(q) diff --git a/command/operator.go b/command/operator.go index 7d6973924..68ae58531 100644 --- a/command/operator.go +++ b/command/operator.go @@ -6,7 +6,6 @@ import ( "strings" "github.com/hashicorp/consul/api" - "github.com/hashicorp/raft" "github.com/mitchellh/cli" "github.com/ryanuber/columnize" ) @@ -160,8 +159,7 @@ func (c *OperatorCommand) raft(args []string) error { w := &api.WriteOptions{ Token: token, } - sa := raft.ServerAddress(address) - if err := operator.RaftRemovePeerByAddress(sa, w); err != nil { + if err := operator.RaftRemovePeerByAddress(address, w); err != nil { return err } c.Ui.Output(fmt.Sprintf("Removed peer with address %q", address))