From a4e8fc6a9ebeedc81475319a49bbcfac35c28214 Mon Sep 17 00:00:00 2001 From: James Lawson Date: Wed, 15 Oct 2014 07:54:36 +0100 Subject: [PATCH 1/5] Added the server list to the cluster startup --- recipes/_service.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/_service.rb b/recipes/_service.rb index f6e757c9..a8cba11c 100644 --- a/recipes/_service.rb +++ b/recipes/_service.rb @@ -75,6 +75,7 @@ service_config['server'] = true if num_cluster > 1 service_config['bootstrap_expect'] = num_cluster + service_config['start_join'] = node['consul']['servers'] else service_config['bootstrap'] = true end From 7c8b9f478b37b26253df73ff8d00c4b43800bebf Mon Sep 17 00:00:00 2001 From: James Lawson Date: Wed, 15 Oct 2014 07:59:50 +0100 Subject: [PATCH 2/5] Bumped version to 0.4.4 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 19d6307a..227171c0 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache v2.0' description 'Installs/Configures consul' long_description 'Installs/Configures consul' -version '0.4.3' +version '0.4.4' recipe 'consul', 'Installs and starts consul service.' recipe 'consul::install_binary', 'Installs consul service from binary.' From 54a7503dd2a30df64611a8b4bc5dd3ee1a061344 Mon Sep 17 00:00:00 2001 From: James Lawson Date: Wed, 15 Oct 2014 14:36:42 +0100 Subject: [PATCH 3/5] Adds server list to a consul instance running as a cluster with a bootstrap_expect value greater than one. --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 141b8517..fec03ce5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 0.4.4 +* Adds server list to a consul instance running as a cluster with a `bootstrap_expect` value greater than one. + # 0.4.3 * Fix race condition when installing Consul as a runit service * Documentation fixes From e8a53f40d277a2dfc86b5b02c1229ce23f8f8296 Mon Sep 17 00:00:00 2001 From: James Lawson Date: Wed, 15 Oct 2014 14:59:51 +0100 Subject: [PATCH 4/5] Adds server list to a consul instance running as a cluster with a bootstrap_expect value greater than one. --- spec/unit/recipes/_service_spec.rb | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/spec/unit/recipes/_service_spec.rb b/spec/unit/recipes/_service_spec.rb index af75c8e1..dc1b6fae 100644 --- a/spec/unit/recipes/_service_spec.rb +++ b/spec/unit/recipes/_service_spec.rb @@ -67,4 +67,38 @@ expect(chef_run).to start_runit_service('consul') end end + + context 'with a cluster service_mode, bootstrap_expect > 1, and a server list to join' do + let(:chef_run) do + ChefSpec::Runner.new(node_attributes) do |node| + node.set['consul']['service_mode'] = 'cluster' + node.set['consul']['bootstrap_expect'] = '3' + node.set['consul']['servers'] = [ 'server1', 'server2', 'server3' ] + end.converge(described_recipe) + end + it do + expect(chef_run).to create_file('/etc/consul.d/default.json') + .with_content(/start_join/) + .with_content(/server1/) + .with_content(/server2/) + .with_content(/server3/) + end + end + + context 'with a cluster service_mode, bootstrap_expect = 1, and a server list' do + let(:chef_run) do + ChefSpec::Runner.new(node_attributes) do |node| + node.set['consul']['service_mode'] = 'cluster' + node.set['consul']['bootstrap_expect'] = '1' + node.set['consul']['servers'] = [ 'server1', 'server2', 'server3' ] + end.converge(described_recipe) + end + it do + expect(chef_run).to_not create_file('/etc/consul.d/default.json') + .with_content(/start_join/) + .with_content(/server1/) + .with_content(/server2/) + .with_content(/server3/) + end + end end From b64db63628ee3f0f81d3efc08665f35ecddca8ba Mon Sep 17 00:00:00 2001 From: James Lawson Date: Thu, 16 Oct 2014 08:29:47 +0100 Subject: [PATCH 5/5] Revert "Bumped version to 0.4.4" This reverts commit 7c8b9f478b37b26253df73ff8d00c4b43800bebf. --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 227171c0..19d6307a 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache v2.0' description 'Installs/Configures consul' long_description 'Installs/Configures consul' -version '0.4.4' +version '0.4.3' recipe 'consul', 'Installs and starts consul service.' recipe 'consul::install_binary', 'Installs consul service from binary.'