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

rework how module manages the service #461

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
# [package_version]
# The package version to upgrade to. Explicitly specify the version to upgrade to,
# or set to 'auto' to specify the version of the compiling master.
# [manage_service]
# A boolean to simply indicate if we should ensure the service is running.
# If not, don't touch it
# [service_names]
# An array of services to start, normally `puppet` and `mcollective`.
# None will be started if the array is empty.
Expand Down Expand Up @@ -97,6 +100,7 @@
$manage_repo = true,
$package_name = 'puppet-agent',
$package_version = undef,
$manage_service = true,
$service_names = $::puppet_agent::params::service_names,
$source = undef,
$absolute_source = undef,
Expand Down Expand Up @@ -194,7 +198,7 @@
# - On Windows, services are handled by the puppet-agent MSI packages themselves.
# ...but outside of PE, on other platforms, we must make sure the services are restarted. We do that with the
# ::puppet_agent::service class. Make sure it's applied after the install process finishes if needed:
if $::osfamily != 'windows' and (!$is_pe or versioncmp($::clientversion, '4.0.0') < 0) {
if !$is_pe or versioncmp($::clientversion, '4.0.0') < 0 {
class { '::puppet_agent::service':
require => Class['::puppet_agent::install'],
}
Expand Down
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
if ($::osfamily == 'Solaris' and $::operatingsystemmajrelease == '11') {
# Solaris 11 is a special case; it uses a custom script.
$service_names = []
} elsif $::osfamily == 'windows' {
$service_names = ['puppet']
} else {
# Mcollective will be removed from this list in the service manifest if
# the puppet version is >= 6.0.0
Expand Down
5 changes: 4 additions & 1 deletion manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
file { ['/var/opt/lib', '/var/opt/lib/pe-puppet', '/var/opt/lib/pe-puppet/state']:
ensure => directory,
}
} else {
}

# as per class comment, this is where we actually manage the service proper.
if $::puppet_agent::manage_service {
$_service_names.each |$service| {
service { $service:
ensure => running,
Expand Down