Skip to content

Commit

Permalink
Fixes voxpupuli#105 - init_defaults doesn't work properly with java o…
Browse files Browse the repository at this point in the history
…pts values

Adding single quotes to the augeas set command allows users to pass in
ES_JAVA_OPTS with double quotes. See voxpupuli#105 for more information.

Update tests and add ES_JAVA_OPTS to assertions
  • Loading branch information
Drew Blessing authored and drewblessing committed Mar 26, 2014
1 parent 640e871 commit 93e50a6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions spec/classes/001_elasticsearch_init_debian_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@

let (:params) {
default_params.merge({
:init_defaults => { 'ES_USER' => 'root', 'ES_GROUP' => 'root' }
:init_defaults => { 'ES_USER' => 'root', 'ES_GROUP' => 'root', 'ES_JAVA_OPTS' => '"-server -XX:+UseTLAB -XX:+CMSClassUnloadingEnabled"' }
})
}

it { should contain_augeas('defaults_elasticsearch').with(:notify => 'Service[elasticsearch]', :incl => '/etc/default/elasticsearch', :changes => "set ES_GROUP root\nset ES_USER root\n") }
it { should contain_augeas('defaults_elasticsearch').with(:notify => 'Service[elasticsearch]', :incl => '/etc/default/elasticsearch', :changes => "set ES_GROUP 'root'\nset ES_JAVA_OPTS '\"-server -XX:+UseTLAB -XX:+CMSClassUnloadingEnabled\"'\nset ES_USER 'root'\n") }

end

Expand All @@ -199,12 +199,12 @@

let (:params) {
default_params.merge({
:init_defaults => { 'ES_USER' => 'root', 'ES_GROUP' => 'root' },
:init_defaults => { 'ES_USER' => 'root', 'ES_GROUP' => 'root', 'ES_JAVA_OPTS' => '"-server -XX:+UseTLAB -XX:+CMSClassUnloadingEnabled"' },
:restart_on_change => false
})
}

it { should contain_augeas('defaults_elasticsearch').with(:incl => '/etc/default/elasticsearch', :changes => "set ES_GROUP root\nset ES_USER root\n").without_notify }
it { should contain_augeas('defaults_elasticsearch').with(:incl => '/etc/default/elasticsearch', :changes => "set ES_GROUP 'root'\nset ES_JAVA_OPTS '\"-server -XX:+UseTLAB -XX:+CMSClassUnloadingEnabled\"'\nset ES_USER 'root'\n").without_notify }

end

Expand Down
8 changes: 4 additions & 4 deletions spec/classes/002_elasticsearch_init_redhat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@

let (:params) {
default_params.merge({
:init_defaults => { 'ES_USER' => 'root', 'ES_GROUP' => 'root' }
:init_defaults => { 'ES_USER' => 'root', 'ES_GROUP' => 'root', 'ES_JAVA_OPTS' => '"-server -XX:+UseTLAB -XX:+CMSClassUnloadingEnabled"' }
})
}

it { should contain_augeas('defaults_elasticsearch').with(:notify => 'Service[elasticsearch]', :incl => '/etc/sysconfig/elasticsearch', :changes => "set ES_GROUP root\nset ES_USER root\n") }
it { should contain_augeas('defaults_elasticsearch').with(:notify => 'Service[elasticsearch]', :incl => '/etc/sysconfig/elasticsearch', :changes => "set ES_GROUP 'root'\nset ES_JAVA_OPTS '\"-server -XX:+UseTLAB -XX:+CMSClassUnloadingEnabled\"'\nset ES_USER 'root'\n") }

end

Expand All @@ -199,12 +199,12 @@

let (:params) {
default_params.merge({
:init_defaults => { 'ES_USER' => 'root', 'ES_GROUP' => 'root' },
:init_defaults => { 'ES_USER' => 'root', 'ES_GROUP' => 'root', 'ES_JAVA_OPTS' => '"-server -XX:+UseTLAB -XX:+CMSClassUnloadingEnabled"' },
:restart_on_change => false
})
}

it { should contain_augeas('defaults_elasticsearch').with(:incl => '/etc/sysconfig/elasticsearch', :changes => "set ES_GROUP root\nset ES_USER root\n").without_notify }
it { should contain_augeas('defaults_elasticsearch').with(:incl => '/etc/sysconfig/elasticsearch', :changes => "set ES_GROUP 'root'\nset ES_JAVA_OPTS '\"-server -XX:+UseTLAB -XX:+CMSClassUnloadingEnabled\"'\nset ES_USER 'root'\n").without_notify }

end

Expand Down
8 changes: 4 additions & 4 deletions spec/classes/003_elasticsearch_init_opensuse_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@

let (:params) {
default_params.merge({
:init_defaults => { 'ES_USER' => 'root', 'ES_GROUP' => 'root' }
:init_defaults => { 'ES_USER' => 'root', 'ES_GROUP' => 'root', 'ES_JAVA_OPTS' => '"-server -XX:+UseTLAB -XX:+CMSClassUnloadingEnabled"' }
})
}

it { should contain_augeas('defaults_elasticsearch').with(:notify => 'Service[elasticsearch]', :incl => '/etc/sysconfig/elasticsearch', :changes => "set ES_GROUP root\nset ES_USER root\n") }
it { should contain_augeas('defaults_elasticsearch').with(:notify => 'Service[elasticsearch]', :incl => '/etc/sysconfig/elasticsearch', :changes => "set ES_GROUP 'root'\nset ES_JAVA_OPTS '\"-server -XX:+UseTLAB -XX:+CMSClassUnloadingEnabled\"'\nset ES_USER 'root'\n") }

end

Expand All @@ -199,12 +199,12 @@

let (:params) {
default_params.merge({
:init_defaults => { 'ES_USER' => 'root', 'ES_GROUP' => 'root' },
:init_defaults => { 'ES_USER' => 'root', 'ES_GROUP' => 'root', 'ES_JAVA_OPTS' => '"-server -XX:+UseTLAB -XX:+CMSClassUnloadingEnabled"' },
:restart_on_change => false
})
}

it { should contain_augeas('defaults_elasticsearch').with(:incl => '/etc/sysconfig/elasticsearch', :changes => "set ES_GROUP root\nset ES_USER root\n").without_notify }
it { should contain_augeas('defaults_elasticsearch').with(:incl => '/etc/sysconfig/elasticsearch', :changes => "set ES_GROUP 'root'\nset ES_JAVA_OPTS '\"-server -XX:+UseTLAB -XX:+CMSClassUnloadingEnabled\"'\nset ES_USER 'root'\n").without_notify }

end

Expand Down
2 changes: 1 addition & 1 deletion templates/etc/sysconfig/defaults.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<% @init_defaults.sort.map do |key, value| -%>
set <%= key %> <%= value %>
set <%= key %> '<%= value %>'
<% end -%>

0 comments on commit 93e50a6

Please sign in to comment.