-
-
Notifications
You must be signed in to change notification settings - Fork 599
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dynamically choose user to run plugin commands
Instead of always using the 'elasticsearch' user or the user supplied by the `elasticsearch_user` resource, choose 'root' if we're installing via package, otherwise fall back to the previous logic. This also removes the chown command, since we expect choosing the correct user should get rid of the need for the chown. Fixes #421.
- Loading branch information
Showing
6 changed files
with
61 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
test/fixtures/cookbooks/elasticsearch_test/recipes/shieldwatcher.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Cookbook Name:: elasticsearch_test | ||
# Recipe:: shieldwatcher | ||
|
||
include_recipe "#{cookbook_name}::default_with_plugins" | ||
|
||
# test these since they need to write to 'bin' directory | ||
%w(license shield watcher).each do |plugin_name| | ||
elasticsearch_plugin plugin_name do | ||
notifies :restart, 'elasticsearch_service[elasticsearch]', :delayed | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
require_relative 'spec_helper' | ||
|
||
shared_examples_for 'elasticsearch service' do |service_name = 'elasticsearch', args = {}| | ||
content_match = args[:content] || 'elasticsearch' | ||
|
||
describe service(service_name) do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
|
||
describe command('curl http://localhost:9200') do | ||
its(:stdout) { should match(/elasticsearch/) } | ||
its(:stdout) { should match(/#{content_match}/) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require_relative 'spec_helper' | ||
|
||
describe 'standard elasticsearch install and configure' do | ||
it_behaves_like 'elasticsearch user' | ||
it_behaves_like 'elasticsearch install' | ||
it_behaves_like 'elasticsearch configure' | ||
|
||
# because shield, these now should return failures | ||
it_behaves_like 'elasticsearch plugin', 'head', response_code: 401 | ||
it_behaves_like 'elasticsearch service', 'elasticsearch', content: 'missing authentication' | ||
end | ||
|
||
describe package('elasticsearch') do | ||
it { should be_installed } | ||
end |