diff --git a/CHANGELOG.md b/CHANGELOG.md index 90a16074..4aac0126 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Those parameters can now be specified as class parameters. (#345) - Removed legacy configuration sections: amf, aisexec, logging.logger\_subsys (#345) +- Fix two\_nodes behaviour with expected\_votes = 2 introduced in 3.0.0 (#246) ### Deprecation notes diff --git a/spec/classes/corosync_spec.rb b/spec/classes/corosync_spec.rb index 928cc546..81b87a58 100644 --- a/spec/classes/corosync_spec.rb +++ b/spec/classes/corosync_spec.rb @@ -56,7 +56,7 @@ before do params.merge!( quorum_members: ['node1.test.org', 'node2.test.org', 'node3.test.org'], - votequorum_expected_votes: 2 + votequorum_expected_votes: 3 ) end @@ -67,6 +67,20 @@ end end + context 'when quorum_members is not set and votequorum_expected_votes is set' do + before do + params.merge!( + votequorum_expected_votes: 2 + ) + end + + it 'configures two_node' do + should contain_file('/etc/corosync/corosync.conf').with_content( + %r{two_node: 1} + ) + end + end + context 'when 2 quorum_members are set and votequorum_expected_votes is set' do before do params.merge!( diff --git a/templates/corosync.conf.erb b/templates/corosync.conf.erb index faa117c5..89aa78fe 100644 --- a/templates/corosync.conf.erb +++ b/templates/corosync.conf.erb @@ -100,8 +100,11 @@ quorum { provider: corosync_votequorum <% if @votequorum_expected_votes -%> expected_votes: <%= @votequorum_expected_votes %> +<%-# .to_i is needed for Puppet 3 -%> +<% if @votequorum_expected_votes.to_i == 2 -%> + two_node: 1 <% end -%> -<% if [@quorum_members].flatten.count == 2 -%> +<% elsif [@quorum_members].flatten.count == 2 -%> two_node: 1 <% end -%> }