-
-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial try to use augeas for defaults file management
- Loading branch information
1 parent
772184b
commit 862d677
Showing
7 changed files
with
66 additions
and
40 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
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,39 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe "Service tests:" do | ||
|
||
case fact('osfamily') | ||
when 'RedHat' | ||
defaults_file = '/etc/sysconfig/elasticsearch' | ||
when 'Debian' | ||
defaults_file = '/etc/default/elasticsearch' | ||
when 'Suse' | ||
defaults_file = '/etc/sysconfig/elasticsearch' | ||
end | ||
|
||
|
||
describe "Make sure we can manage the defaults file" do | ||
|
||
context "Change the defaults file" do | ||
it 'should run successfully' do | ||
pp = "class { 'elasticsearch': manage_repo => true, repo_version => '1.0', java_install => true, config => { 'node.name' => 'elasticsearch001' }, init_defaults => { 'USER' => 'root' } }" | ||
|
||
# Run it twice and test for idempotency | ||
apply_manifest(pp, :catch_failures => true) | ||
sleep 10 | ||
expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero | ||
end | ||
end | ||
|
||
context "Make sure we have USER=root" do | ||
|
||
describe file(defaults_file) do | ||
it { should contain 'USER=root' } | ||
it { should_not contain 'USER=elasticsearch' } | ||
end | ||
|
||
end | ||
|
||
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
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,5 +1,3 @@ | ||
### MANAGED BY PUPPET ### | ||
|
||
<% scope.lookupvar('elasticsearch::init_defaults').sort.map do |key, value| -%> | ||
<%= key %>=<%= value %> | ||
set <%= key %> <%= value %> | ||
<% end -%> |