Skip to content

Commit

Permalink
Merge pull request deric#120 from Thor77/fix-sasl-java-opts
Browse files Browse the repository at this point in the history
Fix JAVA_OPTS broken with enabled sasl auth
  • Loading branch information
deric authored Jan 31, 2019
2 parents d2b2e27 + 59e0b8d commit 024c3d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions spec/classes/sasl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
it do
is_expected.to contain_file(
'/etc/zookeeper/conf/environment'
).with_content(/JAVA_OPTS="\${JAVA_OPTS} -Djava.security.auth.login.config=\/etc\/zookeeper\/conf\/jaas.conf"/)
).with_content(/JAVA_OPTS=".* -Djava.security.auth.login.config=\/etc\/zookeeper\/conf\/jaas.conf"/)
end
end

Expand Down Expand Up @@ -63,7 +63,7 @@
it do
is_expected.to contain_file(
'/etc/zookeeper/conf/java.env'
).with_content(/JAVA_OPTS="\${JAVA_OPTS} -Djava.security.auth.login.config=\/etc\/zookeeper\/conf\/jaas.conf"/)
).with_content(/JAVA_OPTS=".* -Djava.security.auth.login.config=\/etc\/zookeeper\/conf\/jaas.conf"/)
end
end

Expand Down
5 changes: 3 additions & 2 deletions templates/conf/environment.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ JAVA=<%= scope.lookupvar("zookeeper::java_bin") %>
ZOOMAIN="<%= scope.lookupvar("zookeeper::zoo_main") %>"
ZOO_LOG4J_PROP="<%= scope.lookupvar("zookeeper::log4j_prop") %>"
JMXLOCALONLY=false
JAVA_OPTS="<%= scope.lookupvar("zookeeper::java_opts") %>"
<% if scope.lookupvar('zookeeper::use_sasl_auth') -%>
JAVA_OPTS="${JAVA_OPTS} -Djava.security.auth.login.config=<%= File.join(scope.lookupvar("zookeeper::cfg_dir"), "jaas.conf") -%>"
JAVA_OPTS="<%= scope.lookupvar("zookeeper::java_opts") %> -Djava.security.auth.login.config=<%= File.join(scope.lookupvar("zookeeper::cfg_dir"), "jaas.conf") -%>"
<% else -%>
JAVA_OPTS="<%= scope.lookupvar("zookeeper::java_opts") %>"
<% end -%>
# will be concatenated with JVMFLAGS var
# see https://github.com/apache/zookeeper/blob/master/bin/zkServer.sh#L78
Expand Down

0 comments on commit 024c3d3

Please sign in to comment.