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

Only notify, subscribe, require corosync service if it shall be managed. #505

Merged
merged 1 commit into from
Jun 14, 2021
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
20 changes: 13 additions & 7 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,12 @@
$corosync_package_require = undef
}

if $manage_corosync_service {
$corosync_service_dependency = Service['corosync']
} else {
$corosync_service_dependency = undef
}

if $package_pacemaker {
package { 'pacemaker':
ensure => $version_pacemaker,
Expand Down Expand Up @@ -488,7 +494,7 @@
mode => '0400',
owner => 'root',
group => 'root',
notify => Service['corosync'],
notify => $corosync_service_dependency,
require => $corosync_package_require,
}
File['/etc/corosync/authkey'] -> File['/etc/corosync/corosync.conf']
Expand All @@ -500,7 +506,7 @@
mode => '0400',
owner => 'root',
group => 'root',
notify => Service['corosync'],
notify => $corosync_service_dependency,
require => $corosync_package_require,
}
File['/etc/corosync/authkey'] -> File['/etc/corosync/corosync.conf']
Expand Down Expand Up @@ -608,7 +614,7 @@
ensure => running,
enable => true,
require => Package[$package_quorum_device],
subscribe => Service['corosync'],
subscribe => $corosync_service_dependency,
}
}

Expand Down Expand Up @@ -719,7 +725,7 @@
'set START "yes"',
],
require => $corosync_package_require,
before => Service['corosync'],
before => $corosync_service_dependency,
}
}
default: {}
Expand All @@ -731,7 +737,7 @@
command => 'echo "Node appears to be on standby" && false',
path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
onlyif => "crm node status|grep ${facts['networking']['hostname']}-standby|grep 'value=\"on\"'",
require => Service['corosync'],
require => $corosync_service_dependency,
}
}

Expand All @@ -740,7 +746,7 @@
command => 'crm node online',
path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
onlyif => "crm node status|grep ${facts['networking']['hostname']}-standby|grep 'value=\"on\"'",
require => Service['corosync'],
require => $corosync_service_dependency,
}
}

Expand All @@ -749,7 +755,7 @@
ensure => running,
enable => $enable_pacemaker_service,
hasrestart => true,
subscribe => Service['corosync'],
subscribe => $corosync_service_dependency,
}
}

Expand Down
2 changes: 1 addition & 1 deletion spec/classes/corosync_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
end

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

Expand Down