Skip to content

Commit

Permalink
validate_cmd for win fix (#164)
Browse files Browse the repository at this point in the history
Fixes #163
  • Loading branch information
yurymuski authored and pcfens committed Apr 26, 2018
1 parent 054ecd8 commit 4d4695a
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions manifests/prospector.pp
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,15 @@
$skip_validation = false
}

$validate_cmd = ($filebeat::disable_config_test or $skip_validation) ? {
true => undef,
default => $filebeat::major_version ? {
'5' => "\"${filebeat::filebeat_path}\" -N -configtest -c \"%\"",
default => "\"${filebeat::filebeat_path}\" -c \"${filebeat::config_file}\" test config",
},
}

case $::kernel {
'Linux' : {
$validate_cmd = ($filebeat::disable_config_test or $skip_validation) ? {
true => undef,
default => $filebeat::major_version ? {
'5' => "\"${filebeat::filebeat_path}\" -N -configtest -c \"%\"",
default => "\"${filebeat::filebeat_path}\" -c \"${filebeat::config_file}\" test config",
},
}
file { "filebeat-${name}":
ensure => $ensure,
path => "${filebeat::config_dir}/${name}.yml",
Expand All @@ -80,6 +79,10 @@
}

'FreeBSD' : {
$validate_cmd = ($filebeat::disable_config_test or $skip_validation) ? {
true => undef,
default => '/usr/local/sbin/filebeat -N -configtest -c %',
}
file { "filebeat-${name}":
ensure => $ensure,
path => "${filebeat::config_dir}/${name}.yml",
Expand All @@ -94,7 +97,17 @@
}

'Windows' : {
$filebeat_path = 'c:\Program Files\Filebeat\filebeat.exe'
$cmd_install_dir = regsubst($filebeat::install_dir, '/', '\\', 'G')
$filebeat_path = join([$cmd_install_dir, 'Filebeat', 'filebeat.exe'], '\\')

$validate_cmd = ($filebeat::disable_config_test or $skip_validation) ? {
true => undef,
default => $::filebeat_version ? {
'5' => "\"${filebeat_path}\" -N -configtest -c \"%\"",
default => "\"${filebeat_path}\" -c \"${filebeat::config_file}\" test config",
},
}

file { "filebeat-${name}":
ensure => $ensure,
path => "${filebeat::config_dir}/${name}.yml",
Expand Down

0 comments on commit 4d4695a

Please sign in to comment.