Closed wolfaba closed 3 years ago
Try the YAML syntax for stripping the final newline, note the minus sign after the greater-than sign:
jira::java_opts: >-
-Datlassian.mail.senddisabled=true
-Datlassian.mail.fetchdisabled=true
-Datlassian.mail.popdisabled=true
Oh, I have not read the page with multiline string description https://yaml-multiline.info/ very sharp! It's really described there too. Thank you for your hint!
Affected Puppet, Ruby, OS and module versions/distributions
How to reproduce (e.g Puppet code you use)
Define
jira::java_opts
as multiline string in YAML (Hiera) as described in Hiera examples in README.md, e.g.And install Jira version newer that 8.9.1.
What are you seeing
This Hiera code will be used in
templates/setenv.sh.erb
file:which generates final shell code as
with this code, jira could not be started becase catalina.sh use this quoted shell variable JAVA_OPTS in eval:
There is error following error in log journal:
Atlassian has changed this eval code in newer versions, in older versions the $JAVA_OPTS variable was unquoted, in newer version the variable is quoted. You can see the quoting of JAVA_OPTS in different Jira versions below:
If the eval is run with unquoted JAVA_OPTS, then the catalina.sh starts java as one command:
If there is quoted JAVA_OPTS in catalina.sh, then it will run two commands:
Here you can see, there is first (incomplete) command with
eval '"/usr/lib/jvm/java-8-openjdk-amd64/bin/java"'
and the second command-Djava.awt.headless=true -Datlassian.standalone=JIRA -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true
, which generates the error/opt/jira/atlassian-jira-software-8.13.0-standalone/bin/catalina.sh: line 572: -Djava.awt.headless=true: command not found
The
eval
shell command evaluates quoted newline as end of the command and the other text interprets as new command. Until Atlassian has started to quote JAVA_OPTS the code has worked flawless. Now, it does not work.As workaround, the jira::java_opts must be defined as simple string in yaml hiera:
Then there will be no newline in JAVA_OPTS and eval works correctly even with quoted $JAVA_OPTS
What behaviour did you expect instead
I expect that
jira::java_opts
multiline block string definition is possible to enter java options and will not store newline character as last character in JAVA_OPTS variable.Is it somehow possible in puppet to remove newline from
jira::java_opts
string defined as multiline block so the codeJAVA_OPTS="<%= scope.lookupvar('jira::java_opts') %> $JAVA_OPTS"
does not keep newline as a part of value of $JAVA_OPTS?Thank you very much for the fix.
Regards
Robert Wolf