Skip to content

Commit

Permalink
Merge pull request #330 from bastelfreak/bla2
Browse files Browse the repository at this point in the history
prohibit empty service_provider fact
  • Loading branch information
bastelfreak authored Jul 12, 2019
2 parents 587c876 + 618fdc0 commit 0105ec3
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 59 deletions.
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

0 comments on commit 0105ec3

Please sign in to comment.