From 4106b75f727900a8b60ab7486b936af5e0d98449 Mon Sep 17 00:00:00 2001 From: lmunro Date: Tue, 10 Feb 2015 11:15:04 +0000 Subject: [PATCH] logstash forwarder working. git install --- ...rder-init-rhel => logstash-forwarder-init} | 0 recipes/forwarder.rb | 23 ++++++++----------- .../forwarder/serverspec/default_spec.rb | 2 +- 3 files changed, 10 insertions(+), 15 deletions(-) rename files/default/{logstash-forwarder-init-rhel => logstash-forwarder-init} (100%) diff --git a/files/default/logstash-forwarder-init-rhel b/files/default/logstash-forwarder-init similarity index 100% rename from files/default/logstash-forwarder-init-rhel rename to files/default/logstash-forwarder-init diff --git a/recipes/forwarder.rb b/recipes/forwarder.rb index 1813284..9f3b762 100644 --- a/recipes/forwarder.rb +++ b/recipes/forwarder.rb @@ -44,25 +44,20 @@ action :checkout end -execute "build_logstash_forwarder" do +execute 'build_logstash_forwarder' do cwd node['logstash_forwarder']['app_dir'] command '/usr/local/go/bin/go build' action :run - user "root" - group "root" - not_if do ::File.exists?("#{node['logstash_forwarder']['app_dir']}/logstash-forwarder") end + user 'root' + group 'root' + not_if { ::File.exist?("#{node['logstash_forwarder']['app_dir']}/logstash-forwarder") } end -case node['platform_family'] -when 'debian' - -when 'rhel' - cookbook_file '/etc/init.d/logstash-forwarder' do - source 'logstash-forwarder-init-rhel' - owner 'root' # init script must be root, not user/group configured - group 'root' - mode 0755 - end +cookbook_file '/etc/init.d/logstash-forwarder' do + source 'logstash-forwarder-init' + owner 'root' # init script must be root, not user/group configured + group 'root' + mode 0755 end require 'json' diff --git a/test/integration/forwarder/serverspec/default_spec.rb b/test/integration/forwarder/serverspec/default_spec.rb index 67a466e..532894a 100644 --- a/test/integration/forwarder/serverspec/default_spec.rb +++ b/test/integration/forwarder/serverspec/default_spec.rb @@ -9,7 +9,7 @@ describe 'logstash-forwarder service' do # can't use process() matcher because of two java processes describe 'should be running Logstash main class' do - describe command('ps aux | grep -v grep | grep -s /opt/logstash-forwarder/bin/logstash-forwarder') do + describe command('ps aux | grep -v grep | grep -s /opt/logstash-forwarder/logstash-forwarder') do its(:exit_status) { should eq 0 } end end