Skip to content
Snippets Groups Projects
Verified Commit 163bfc1a authored by DJ Mountney's avatar DJ Mountney
Browse files

Merge branch '2762-set-default-bootstrap_expect-for-consul-servers' into 'master'

Resolve "Set default bootstrap_expect for consul servers"

Closes #2762

See merge request !1921
parent 9d44ae02
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -25,6 +25,7 @@ omnibus-gitlab repository.
 
- Add more options to repmgr.conf template
- Update pgbouncer to use one style of logging
- Set bootstrap_expect to default to 3 for consul servers
 
9.5.4
 
Loading
Loading
class ConsulHelper
attr_reader :node, :default_configuration
attr_reader :node, :default_configuration, :default_server_configuration
 
def initialize(node)
@node = node
Loading
Loading
@@ -12,6 +12,9 @@ class ConsulHelper
'rejoin_after_leave' => true,
'server' => false
}
@default_server_configuration = {
'bootstrap_expect' => '3'
}
end
 
def watcher_config(watcher)
Loading
Loading
@@ -27,9 +30,15 @@ class ConsulHelper
end
 
def configuration
Chef::Mixin::DeepMerge.merge(
config = Chef::Mixin::DeepMerge.merge(
default_configuration,
node['consul']['configuration']
).select { |k, v| !v.nil? }.to_json
).select { |k, v| !v.nil? }
if config['server']
return Chef::Mixin::DeepMerge.merge(
default_server_configuration, config
).to_json
end
config.to_json
end
end
Loading
Loading
@@ -53,6 +53,12 @@ describe 'consul' do
}
end
 
it 'does not include server default values in its configuration' do
expect(chef_run).to render_file(consul_conf).with_content { |content|
expect(content).not_to match(%r{"bootstrap_expect":"3"})
}
end
it 'creates the necessary directories' do
expect(chef_run).to create_directory('/fake/config.d')
expect(chef_run).to create_directory('/fake/data')
Loading
Loading
@@ -76,6 +82,7 @@ describe 'consul' do
expect(chef_run.node['consul']['configuration']['server']).to eq true
expect(chef_run).to render_file(consul_conf).with_content { |content|
expect(content).to match(%r{"server":true})
expect(content).to match(%r{"bootstrap_expect":"3"})
}
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment