Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added manage corosync feature #424

Merged
merged 1 commit into from
Nov 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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