puppet-elasticsearch icon indicating copy to clipboard operation
puppet-elasticsearch copied to clipboard

jvm_options may not be overridable because of sort in template

Open ThomasLohner opened this issue 6 years ago • 1 comments

  • Module version: 6.4.0 / master
  • Puppet version: all
  • OS and version: all

Bug description

Trying to set the jvm_option -Xms1024m does not work. The resulting jvm.options-File will look like this:

...
-Xms1024m
-Xms2048m
-Xmx1024m
-Xmx2048m
...

This is because of a default -Xms2048m which is set in jvm.options.erb and @jvm_options.sort.each in the same template. Sorting all keys of the jvm_options-Array results in -Xms2048m being written to the File after -Xms1024m. So effectively the default will override what is defined in jvm_options-Array.

How to reproduce

elasticsearch::jvm_options:
  - '-Xms1024m'
  - '-Xmx1024m'

Quickfix

Not nice but effective: Skipping sort will still write both options to jvm.options-File but java will only consider the last occurrence of the same key.

ThomasLohner avatar Sep 12 '19 10:09 ThomasLohner

as workaround the version prefix described in https://github.com/elastic/puppet-elasticsearch/issues/1032#issuecomment-642499082 works.

c33s avatar Dec 09 '20 03:12 c33s