Skip to content

Instantly share code, notes, and snippets.

@garthk
Created February 4, 2013 03:41
Show Gist options
  • Save garthk/4704911 to your computer and use it in GitHub Desktop.
Save garthk/4704911 to your computer and use it in GitHub Desktop.
diff --git a/manifests/params.pp b/manifests/params.pp
index 3278a7a..06b2db5 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -89,27 +89,4 @@ class logstash::params {
for \"${::operatingsystem}\"")
}
}
-
- # parameters when using a custom jar sourcea
- if $logstash::provider == 'custom' {
- ## Set initfile to undef when using an external init file
- if $logstash::initfile != undef {
- $initfile = undef
- } else {
- ## Get the init file we provide
- case $::operatingsystem {
- 'RedHat', 'CentOS', 'Fedora', 'Scientific': {
- $initfile = template("${module_name}/etc/init.d/logstash.init.RedHat.erb")
- }
- 'Debian', 'Ubuntu': {
- $initfile = template("${module_name}/etc/init.d/logstash.init.Debian.erb")
- }
- default: {
- fail("\"${module_name}\" provides no default init file
- for \"${::operatingsystem}\"")
- }
- }
- }
- }
-
}
diff --git a/manifests/service.pp b/manifests/service.pp
index 1a62dc4..b5820a6 100644
--- a/manifests/service.pp
+++ b/manifests/service.pp
@@ -81,15 +81,36 @@ class logstash::service {
mode => '0644'
}
- # If we are using a custom provider, thus not using the package
+ # Provide init script if using custom provider
if $logstash::provider == 'custom' {
+ if $logstash::initfile != undef {
+ $initscript = undef
+ } else {
+ case $::operatingsystem {
+ 'RedHat', 'CentOS', 'Fedora', 'Scientific': {
+ $initscript = template("${module_name}/etc/init.d/logstash.init.RedHat.erb")
+ }
+
+ 'Debian', 'Ubuntu': {
+ $initscript = template("${module_name}/etc/init.d/logstash.init.Debian.erb")
+ }
+
+ default: {
+ fail("\"${module_name}\" provides no default init file
+ for \"${::operatingsystem}\"")
+ }
+
+ }
+
+ }
file { '/etc/init.d/logstash':
ensure => present,
mode => '0755',
- content => $logstash::params::initfile, # undef when using an external source, otherwise content of our own init script
- source => $logstash::initfile, # undef when using content of our own init script, otherwise it contains the source of the external init script
+ content => $initscript, # undef if $logstash::initfile provided
+ source => $logstash::initfile,
}
+
}
# If we supply a defaults file, place it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment