From 9ad564ca5494ab3c4f6da903b52bdf8ae3526bb0 Mon Sep 17 00:00:00 2001 From: Jacob Dearing Date: Mon, 27 Jul 2015 17:35:46 -0500 Subject: [PATCH] correct elasticsearch bin location --- libraries/provider_elasticsearch.rb | 5 ++++- libraries/provider_kibana.rb | 2 +- libraries/provider_logstash.rb | 1 + templates/default/sv-elasticsearch-run.erb | 2 +- templates/default/sv-kibana-run.erb | 2 +- test/integration/helpers/serverspec/elasticsearch.rb | 10 ++++------ 6 files changed, 12 insertions(+), 10 deletions(-) mode change 100755 => 100644 test/integration/helpers/serverspec/elasticsearch.rb diff --git a/libraries/provider_elasticsearch.rb b/libraries/provider_elasticsearch.rb index fbc55f4..bf4d50b 100644 --- a/libraries/provider_elasticsearch.rb +++ b/libraries/provider_elasticsearch.rb @@ -10,6 +10,9 @@ class Elasticsearch < Chef::Provider::LWRPBase service_name = 'elasticsearch' action :install do + + home_dir = "#{new_resource.path}/elasticsearch-#{new_resource.version}" + user new_resource.user group new_resource.group @@ -30,7 +33,7 @@ class Elasticsearch < Chef::Provider::LWRPBase cookbook new_resource.source env new_resource.runit_env options new_resource.runit_options.merge( - 'install_path' => "#{new_resource.path}/#{new_resource.name}-#{new_resource.version}", + 'home_dir' => home_dir, 'user' => new_resource.user, 'group' => new_resource.group ) diff --git a/libraries/provider_kibana.rb b/libraries/provider_kibana.rb index 36a1be6..8b6c7b8 100644 --- a/libraries/provider_kibana.rb +++ b/libraries/provider_kibana.rb @@ -63,7 +63,7 @@ class Kibana < Chef::Provider::LWRPBase cookbook new_resource.source env new_resource.runit_env options new_resource.runit_options.merge( - 'install_path' => home_dir, + 'home_dir' => home_dir, 'user' => new_resource.user, 'group' => new_resource.group, 'config_file' => "#{home_dir}/config/kibana.yml" diff --git a/libraries/provider_logstash.rb b/libraries/provider_logstash.rb index 4d35e7d..8b14a77 100644 --- a/libraries/provider_logstash.rb +++ b/libraries/provider_logstash.rb @@ -16,6 +16,7 @@ class Logstash < Chef::Provider::LWRPBase owner new_resource.user group new_resource.group mode '0755' + recursive true action :create end diff --git a/templates/default/sv-elasticsearch-run.erb b/templates/default/sv-elasticsearch-run.erb index aa7042d..5c77a09 100644 --- a/templates/default/sv-elasticsearch-run.erb +++ b/templates/default/sv-elasticsearch-run.erb @@ -1,6 +1,6 @@ #!/bin/sh -cd <%= @options['install_path'] %> +cd <%= @options['home_dir'] %> exec 2>&1 chpst -u :<%= @options['user'] %>:<%= @options['group'] %> diff --git a/templates/default/sv-kibana-run.erb b/templates/default/sv-kibana-run.erb index 012447c..e95885a 100644 --- a/templates/default/sv-kibana-run.erb +++ b/templates/default/sv-kibana-run.erb @@ -1,6 +1,6 @@ #!/bin/sh -cd <%= @options['install_path'] %> +cd <%= @options['home_dir'] %> exec 2>&1 chpst -u :<%= @options['user'] %>:<%= @options['group'] %> diff --git a/test/integration/helpers/serverspec/elasticsearch.rb b/test/integration/helpers/serverspec/elasticsearch.rb old mode 100755 new mode 100644 index e6a2845..f14854b --- a/test/integration/helpers/serverspec/elasticsearch.rb +++ b/test/integration/helpers/serverspec/elasticsearch.rb @@ -1,12 +1,10 @@ # sshd_service = os[:family] == 'redhat' ? 'sshd' : 'ssh' shared_examples 'elasticsearch' do - describe service('elasticsearch') do - it 'is enabled and running' do - expect(subject).to be_enabled - expect(subject).to be_running - end - end + describe command('sv status elasticsearch') do + its(:stdout) { should match /run: elasticsearch/ } + end end # curl -X GET http://localhost:9200/ +# curl 'localhost:9200/_cat/health?v'