Skip to content

Commit

Permalink
Add possibility to define watchdog_device resource
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian Lukowski authored and Damian Lukowski committed Mar 1, 2021
1 parent 37d0c04 commit de92e05
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
6 changes: 6 additions & 0 deletions manifests/init.pp
Expand Up @@ -315,6 +315,11 @@
# Whether we should test new configuration files with `corosync -t`.
# (requires corosync 2.3.4)
#
# @param watchdog_device
# Watchdog device to use, for example '/dev/watchdog' or 'off'.
# Its presence (or lack thereof) shifted with corosync versions.
# Default: undef
#
# @example Simple configuration without secauth
#
# class { 'corosync':
Expand Down Expand Up @@ -400,6 +405,7 @@
Optional[Enum['yes', 'no']] $clear_node_high_bit = undef,
Optional[Integer] $max_messages = undef,
Boolean $test_corosync_config = $corosync::params::test_corosync_config,
Optional[Variant[Stdlib::Absolutepath, Enum['off']]] $watchdog_device = undef,
) inherits corosync::params {
if $set_votequorum and (empty($quorum_members) and empty($multicast_address) and !$cluster_name) {
fail('set_votequorum is true, so you must set either quorum_members, or one of multicast_address or cluster_name.')
Expand Down
22 changes: 22 additions & 0 deletions spec/classes/corosync_spec.rb
Expand Up @@ -442,6 +442,28 @@
end
end

context 'with undefined watchdog_device' do
it 'does not configure watchdog_device resource' do
is_expected.to contain_file('/etc/corosync/corosync.conf').without_content(
%r{watchdog_device:}
)
end
end

context 'with defined watchdog_device' do
before do
params.merge!(
watchdog_device: 'off'
)
end

it 'configures watchdog_device resource' do
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{watchdog_device: off}
)
end
end

context 'when log_file and log_file_name are set' do
let(:params) do
super().merge(
Expand Down
6 changes: 6 additions & 0 deletions templates/corosync.conf.erb
Expand Up @@ -166,3 +166,9 @@ nodelist {
}
<% end -%>
<% end -%>
<% unless @watchdog_device.nil? -%>
resources {
watchdog_device: <%= @watchdog_device %>
}
<% end -%>

0 comments on commit de92e05

Please sign in to comment.