From a36e58c964900fb325fb43a0aa3ba9e22ef878b2 Mon Sep 17 00:00:00 2001 From: Hans Hasselberg Date: Fri, 6 Dec 2019 21:35:58 +0100 Subject: [PATCH] agent: fewer file local differences between enterprise and oss (#6820) (#6898) * Increase number to test ignore. Consul Enterprise has more flags and since we are trying to reduce the differences between both code bases, we are increasing the number in oss. The semantics don't change, it is just a cosmetic thing. * Introduce agent.initEnterprise for enterprise related hooks. * Sync test with ent version. * Fix import order. * revert error wording. --- agent/agent.go | 2 ++ agent/agent_oss.go | 8 ++++++++ agent/consul/fsm/fsm_test.go | 2 +- lib/serf.go | 3 ++- 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 agent/agent_oss.go diff --git a/agent/agent.go b/agent/agent.go index 7922900f5..0413e6d70 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -410,6 +410,8 @@ func (a *Agent) Start() error { // waiting to discover a consul server consulCfg.ServerUp = a.sync.SyncFull.Trigger + a.initEnterprise(consulCfg) + tlsConfigurator, err := tlsutil.NewConfigurator(c.ToTLSUtilConfig(), a.logger) if err != nil { return err diff --git a/agent/agent_oss.go b/agent/agent_oss.go new file mode 100644 index 000000000..a3bb52ff2 --- /dev/null +++ b/agent/agent_oss.go @@ -0,0 +1,8 @@ +// +build !consulent + +package agent + +import "github.com/hashicorp/consul/agent/consul" + +func (a *Agent) initEnterprise(consulCfg *consul.Config) { +} diff --git a/agent/consul/fsm/fsm_test.go b/agent/consul/fsm/fsm_test.go index 47ff7ac92..d0cd26b1e 100644 --- a/agent/consul/fsm/fsm_test.go +++ b/agent/consul/fsm/fsm_test.go @@ -47,7 +47,7 @@ func TestFSM_IgnoreUnknown(t *testing.T) { Foo string } req := UnknownRequest{Foo: "bar"} - msgType := structs.IgnoreUnknownTypeFlag | 64 + msgType := structs.IgnoreUnknownTypeFlag | 75 buf, err := structs.Encode(msgType, req) assert.Nil(t, err) diff --git a/lib/serf.go b/lib/serf.go index 36b2d549b..c0b6e5126 100644 --- a/lib/serf.go +++ b/lib/serf.go @@ -1,8 +1,9 @@ package lib import ( - "github.com/hashicorp/serf/serf" "time" + + "github.com/hashicorp/serf/serf" ) // SerfDefaultConfig returns a Consul-flavored Serf default configuration,