Passing variables to template


#1

All -

I’m deploying an app to a Tomcat 7 server that has a set of JAVA_OPTS that need to be placed in ../tomcat/current/bin/catalina.sh. Therefore I’ve created a template that is the catalina.sh file with a place holder where the JAVA_OPTS ought to be.

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

<% @java_opts %>

-----------------------------------------------------------------------------

Control Script for the CATALINA Server

Then in my recipe I have this:

create properties file

template “/as/app/tomcat/current/bin/catalina.sh” do
source "catalina.sh.erb"
mode "0755"
owner "tomcat"
group "root"
variables({
:java_opts => node[‘tomcat’][‘java_opts’]
})
end

And the final piece attributes/default.rb

JAVA_OPTS

default[‘tomcat’][‘java_opts’] = ‘JAVA_OPTS="-server -Xms768M -Xmx768M -XX:MaxPermSize=256M -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Dreusestatement.debug.sql=true -Ddevel -DdebugOn=true -DextendedLoggingOn -Dlog4j.configuratorClass=ksutelc.common.log.TelcConfigurator -DdisableProcessingUnhandledExceptions"’

Unfortunately when I run this I’m not getting anything in catalina.sh for JAVA_OPTS.

What am I missing or not seeing here?

Thanks,
Mark


mark nichols | @zanshin | zanshin.net


#2

change <% @java_opts %>
to <%= @java_opts %> ?

On Fri, Feb 7, 2014 at 12:18 PM, Mark H. Nichols chef@zanshin.net wrote:

All -

I’m deploying an app to a Tomcat 7 server that has a set of JAVA_OPTS that
need to be placed in ../tomcat/current/bin/catalina.sh. Therefore I’ve
created a template that is the catalina.sh file with a place holder where
the JAVA_OPTS ought to be.

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

<% @java_opts %>


Control Script for the CATALINA Server

Then in my recipe I have this:

create properties file

template “/as/app/tomcat/current/bin/catalina.sh” do
source "catalina.sh.erb"
mode "0755"
owner "tomcat"
group "root"
variables({
:java_opts => node[‘tomcat’][‘java_opts’]
})
end

And the final piece attributes/default.rb

JAVA_OPTS

default[‘tomcat’][‘java_opts’] = ‘JAVA_OPTS="-server -Xms768M -Xmx768M
-XX:MaxPermSize=256M -Djava.net.preferIPv4Stack=true
-Djava.awt.headless=true -Dreusestatement.debug.sql=true -Ddevel
-DdebugOn=true -DextendedLoggingOn
-Dlog4j.configuratorClass=ksutelc.common.log.TelcConfigurator
-DdisableProcessingUnhandledExceptions"’

Unfortunately when I run this I’m not getting anything in catalina.sh
for JAVA_OPTS.

What am I missing or not seeing here?

Thanks,
Mark


mark nichols | @zanshin | zanshin.net


#3

On Feb 7, 2014, at 2:40 PM, Ranjib Dey dey.ranjib@gmail.com wrote:

change <% @java_opts %>
to <%= @java_opts %> ?

That was it. Thanks. Couldn’t see the tree for the bark there.

— Mark