Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init_defaults doesn't work properly with java opts values #105

Closed
dblessing opened this issue Mar 26, 2014 · 10 comments · Fixed by #106
Closed

init_defaults doesn't work properly with java opts values #105

dblessing opened this issue Mar 26, 2014 · 10 comments · Fixed by #106

Comments

@dblessing
Copy link
Contributor

One of the configs that can be set in the elasticsearch defaults file is ES_JAVA_OPTS. There are 2 issues in this module that cause settings this variable to fail.

First, I think there need to be quotes around the value in the set command - i.e. "set ES_JAVA_OPTS "values here". Right now there are no quotes.

Second, even with quotes it appears the shellvars lens doesn't like the java opts value - probably because there are spaces in it. Being able to set java_opts in this file is critical for us so we can add some GC and JMX options.

@electrical
Copy link
Contributor

Interesting issue. can you give me an example value for the ES_JAVA_OPTS?
Will do some investigation on this and add testing.

@dblessing
Copy link
Contributor Author

I found this discussion from a while back, but I think the solution is valid. http://www.redhat.com/archives/augeas-devel/2008-October/msg00023.html

In a quick test I put single quotes around the <%= value %> in defaults.erb so it looks like this:

<% @init_defaults.sort.map do |key, value| -%>
set <%= key %> '<%= value %>'
<% end -%>

Then, in my init_defaults hash I set
ES_JAVA_OPTS => '"-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9012 -Dcom.sun.management.jmxremote.ssl=false"' as an example (that's double quotes wrapped in single quotes). The end result is that the set command looks like:
set ES_JAVA_OPTS '"-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9012 -Dcom.sun.management.jmxremote.ssl=false"'

The double quotes carry through and end up as the following line in /etc/sysconfig/elasticsearch - and works beautifully.
ES_JAVA_OPTS="-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9012 -Dcom.sun.management.jmxremote.ssl=false"

Would you be interested in a fix like this? It's completely backward compatible as far as I can tell.

@electrical
Copy link
Contributor

Ahh interesting. Totally didn't expect that.
Assuming it won't cause any issues with other values ( numbers, true/false ) im happy with the fix :-)

@dblessing
Copy link
Contributor Author

Ok, I'll see if I can write some tests. Thanks for the feedback.

dblessing pushed a commit to dblessing/puppet-elasticsearch that referenced this issue Mar 26, 2014
@dblessing
Copy link
Contributor Author

I made the change. I don't think it will break current tests. I'm struggling to get the tests working on my box so I'm not sure if I'll be able to add new tests.

@dblessing
Copy link
Contributor Author

What command is needed to execute the tests? Including ENV vars? I think that's my issue.

@electrical
Copy link
Contributor

Hi,

Commands are in .travis.yml file but might fail in certain scenario's because i messed something up.

bundle install
bundle exec rake spec SPEC_OPTS='--format documentation'

@dblessing
Copy link
Contributor Author

\o/ Thank you!

dblessing pushed a commit to dblessing/puppet-elasticsearch that referenced this issue Mar 26, 2014
…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
@dblessing
Copy link
Contributor Author

Updated PR #106 with tests to account for this change.

dblessing pushed a commit to dblessing/puppet-elasticsearch that referenced this issue Mar 26, 2014
…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
electrical added a commit that referenced this issue Mar 28, 2014
Add single quotes to value. Fixes #105
@elisiano
Copy link

I'm seeing this with the latest version of the module (from the forge - 0.15.0).
Since we cannot specify ES_HEAP_SIZE anymore with elasticsearch 5, I set ES_JAVA_OPTS but when I try with the space (ES_JAVA_OPTS="-Xms8g -Xmx8g") then augeasproviders_shellvar fails.

When I try with just ES_JAVA_OPTS="-Xmx8g" it works fine.

Anyone aware of a workaround?

cegeka-jenkins pushed a commit to cegeka/puppet-elasticsearch that referenced this issue Oct 23, 2017
…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
cegeka-jenkins pushed a commit to cegeka/puppet-elasticsearch that referenced this issue Oct 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants