diff --git a/manifests/init.pp b/manifests/init.pp index 4398dd2..63995d4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -17,6 +17,8 @@ # Class to install common logstash items. # class logstash { + include ::logrotate + archive { '/tmp/logstash_2.0.0-1_all.deb': source => 'https://download.elastic.co/logstash/logstash/packages/debian/logstash_2.0.0-1_all.deb', extract => false, @@ -35,6 +37,7 @@ class logstash { source => '/tmp/logstash_2.0.0-1_all.deb', provider => 'dpkg', require => [ + Package['logrotate'], Package['openjdk-7-jre-headless'], Archive['/tmp/logstash_2.0.0-1_all.deb'], ] diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb index 79c3363..3bf7908 100644 --- a/spec/acceptance/basic_spec.rb +++ b/spec/acceptance/basic_spec.rb @@ -20,45 +20,6 @@ describe 'puppet-logstash module', :if => ['debian', 'ubuntu'].include?(os[:fami end describe 'require files' do - describe 'module logstash' do - describe file('/opt/logstash/logstash-1.3.3-flatjar.jar') do - it { should be_file } - it { should be_owned_by 'logstash' } - it { should be_grouped_into 'logstash' } - end - - describe file('/opt/logstash/logstash.jar') do - it { should be_linked_to '/opt/logstash/logstash-1.3.3-flatjar.jar' } - end - - describe file('/var/log/logstash') do - it { should be_directory } - it { should be_owned_by 'logstash' } - it { should be_grouped_into 'logstash' } - end - - describe file('/etc/logstash') do - it { should be_directory } - it { should be_owned_by 'logstash' } - it { should be_grouped_into 'logstash' } - end - end - - describe 'module logstash::agent' do - describe file('/etc/init/logstash-agent.conf') do - it { should be_file } - it { should be_owned_by 'root' } - its(:content) { should include 'description "logstash agent instance"' } - end - - describe file('/etc/logstash/agent.conf') do - it { should be_file } - it { should be_owned_by 'logstash' } - it { should be_grouped_into 'logstash' } - its(:content) { should include 'redis { host => "127.0.0.1" data_type => "list" key => "logstash" }' } - end - end - describe 'module logstash::elasticsearch' do describe file('/etc/elasticsearch/templates/logstash_settings.json') do it { should be_file } @@ -69,21 +30,16 @@ describe 'puppet-logstash module', :if => ['debian', 'ubuntu'].include?(os[:fami end describe 'module logstash::indexer' do - describe file('/etc/init/logstash-indexer.conf') do - it { should be_file } - it { should be_owned_by 'root' } - its(:content) { should include 'description "logstash indexer instance"' } - end - - describe file('/etc/logstash/indexer.conf') do + describe file('/etc/logstash/conf.d/indexer.conf') do it { should be_file } it { should be_owned_by 'logstash' } it { should be_grouped_into 'logstash' } + its(:content) { should include 'type => "redis-input"' } its(:content) { should include 'host => "127.0.0.1"' } end - describe file('/etc/logrotate.d/indexer.log') do - its(:content) { should include '/var/log/logstash/indexer.log' } + describe file('/etc/default/logstash') do + its(:content) { should include 'LS_OPTS="-w 1"' } end end end @@ -92,29 +48,16 @@ describe 'puppet-logstash module', :if => ['debian', 'ubuntu'].include?(os[:fami describe package('openjdk-7-jre-headless') do it { should be_installed } end + + describe package('logstash') do + it { should be_installed } + end end describe 'required services' do - describe service('logstash-agent') do + describe service('logstash') do it { should be_enabled } it { should be_running } end - - describe service('logstash-indexer') do - it { should be_enabled } - it { should be_running } - end - end - - describe 'required user' do - describe user('logstash') do - it { should exist } - it { should belong_to_group 'logstash' } - it { should have_home_directory '/opt/logstash' } - end - - describe group('logstash') do - it { should exist } - end end end diff --git a/spec/acceptance/fixtures/default.pp b/spec/acceptance/fixtures/default.pp index 4d2992e..86eea2a 100644 --- a/spec/acceptance/fixtures/default.pp +++ b/spec/acceptance/fixtures/default.pp @@ -15,10 +15,6 @@ file { '/etc/elasticsearch/templates': class { '::logstash': } -class { '::logstash::agent': - require => Class['::logstash'], -} - class { '::logstash::elasticsearch': require => Class['::logstash'], }