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

prohibit empty service_provider fact #330

Merged
merged 1 commit into from
Jul 12, 2019
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
114 changes: 56 additions & 58 deletions manifests/daemon.pp
Original file line number Diff line number Diff line change
Expand Up @@ -162,72 +162,70 @@
}


if $init_style {
case $init_style {
'upstart' : {
file { "/etc/init/${name}.conf":
mode => '0444',
owner => 'root',
group => 'root',
content => template('prometheus/daemon.upstart.erb'),
notify => $notify_service,
}
file { "/etc/init.d/${name}":
ensure => link,
target => '/lib/init/upstart-job',
owner => 'root',
group => 'root',
mode => '0755',
}
case $init_style {
'upstart' : {
file { "/etc/init/${name}.conf":
mode => '0444',
owner => 'root',
group => 'root',
content => template('prometheus/daemon.upstart.erb'),
notify => $notify_service,
}
'systemd' : {
include 'systemd'
systemd::unit_file {"${name}.service":
content => template('prometheus/daemon.systemd.erb'),
notify => $notify_service,
}
file { "/etc/init.d/${name}":
ensure => link,
target => '/lib/init/upstart-job',
owner => 'root',
group => 'root',
mode => '0755',
}
# service_provider returns redhat on CentOS using sysv, https://tickets.puppetlabs.com/browse/PUP-5296
'sysv','redhat' : {
file { "/etc/init.d/${name}":
mode => '0555',
owner => 'root',
group => 'root',
content => template('prometheus/daemon.sysv.erb'),
notify => $notify_service,
}
}
'systemd' : {
include 'systemd'
systemd::unit_file {"${name}.service":
content => template('prometheus/daemon.systemd.erb'),
notify => $notify_service,
}
'debian' : {
file { "/etc/init.d/${name}":
mode => '0555',
owner => 'root',
group => 'root',
content => template('prometheus/daemon.debian.erb'),
notify => $notify_service,
}
}
# service_provider returns redhat on CentOS using sysv, https://tickets.puppetlabs.com/browse/PUP-5296
'sysv','redhat' : {
file { "/etc/init.d/${name}":
mode => '0555',
owner => 'root',
group => 'root',
content => template('prometheus/daemon.sysv.erb'),
notify => $notify_service,
}
'sles' : {
file { "/etc/init.d/${name}":
mode => '0555',
owner => 'root',
group => 'root',
content => template('prometheus/daemon.sles.erb'),
notify => $notify_service,
}
}
'debian' : {
file { "/etc/init.d/${name}":
mode => '0555',
owner => 'root',
group => 'root',
content => template('prometheus/daemon.debian.erb'),
notify => $notify_service,
}
'launchd' : {
file { "/Library/LaunchDaemons/io.${name}.daemon.plist":
mode => '0644',
owner => 'root',
group => 'wheel',
content => template('prometheus/daemon.launchd.erb'),
notify => $notify_service,
}
}
'sles' : {
file { "/etc/init.d/${name}":
mode => '0555',
owner => 'root',
group => 'root',
content => template('prometheus/daemon.sles.erb'),
notify => $notify_service,
}
default : {
fail("I don't know how to create an init script for style ${init_style}")
}
'launchd' : {
file { "/Library/LaunchDaemons/io.${name}.daemon.plist":
mode => '0644',
owner => 'root',
group => 'wheel',
content => template('prometheus/daemon.launchd.erb'),
notify => $notify_service,
}
}
default : {
fail("I don't know how to create an init script for style ${init_style}")
}
}

if $env_file_path != undef {
Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
String $service_ensure,
Boolean $manage_service,
Boolean $restart_on_change,
String $init_style,
String[1] $init_style,
Optional[String[1]] $extra_options,
Optional[String] $download_url,
String $arch,
Expand Down