Skip to content

Commit

Permalink
Added manage corosync feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekototori committed Nov 15, 2017
1 parent 0f05e08 commit 656b8dd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
19 changes: 13 additions & 6 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,17 @@
# Whether the module should enable the corosync service.
# Default: true
#
# [*manage_corosync_service*]
# Whether the module should try to manage the corosync service. If set to
# false, the service will need to be specified in the catalog elsewhere.
# Default: true
#
# [*enable_pacemaker_service*]
# Whether the module should enable the pacemaker service.
# Default: true
#
# [*manage_pacemaker_service*]
# Whether the module should try to manage the pacemaker service in
# addition to the corosync service.
# Whether the module should try to manage the pacemaker service.
# Default (Red Hat based >= 7): true
# Default (Ubuntu >= 14.04): true
# Default (otherwise): false
Expand Down Expand Up @@ -322,6 +326,7 @@
Optional[Integer] $token_retransmits_before_loss_const = undef,
Optional[String] $compatibility = undef,
Boolean $enable_corosync_service = $corosync::params::enable_corosync_service,
Boolean $manage_corosync_service = $corosync::params::manage_corosync_service,
Boolean $enable_pacemaker_service = $corosync::params::enable_pacemaker_service,
Boolean $manage_pacemaker_service = $corosync::params::manage_pacemaker_service,
Boolean $enable_pcsd_service = $corosync::params::enable_pcsd_service,
Expand Down Expand Up @@ -515,9 +520,11 @@
}
}

service { 'corosync':
ensure => running,
enable => $enable_corosync_service,
subscribe => File[ [ '/etc/corosync/corosync.conf', '/etc/corosync/service.d' ] ],
if $manage_corosync_service {
service { 'corosync':
ensure => running,
enable => $enable_corosync_service,
subscribe => File[ [ '/etc/corosync/corosync.conf', '/etc/corosync/service.d' ] ],
}
}
}
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
$version_pacemaker = 'present'
$version_pcs = 'present'
$enable_corosync_service = true
$manage_corosync_service = true
$enable_pacemaker_service = true
$enable_pcsd_service = true

Expand Down
18 changes: 18 additions & 0 deletions spec/classes/corosync_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@
shared_examples_for 'corosync' do
it { is_expected.to compile.with_all_deps }

it 'does manage the corosync service' do
is_expected.to contain_service('corosync').with(
ensure: 'running'
)
end

context 'when manage_corosync_service is false' do
before do
params.merge!(
manage_corosync_service: false
)
end

it 'is not managing corosync service' do
is_expected.not_to compile
end
end

context 'when set_votequorum is true' do
before do
params.merge!(
Expand Down

0 comments on commit 656b8dd

Please sign in to comment.