[chef] Re: Passing variables to template


Chronological Thread 
  • From: Ranjib Dey < >
  • To:
  • Subject: [chef] Re: Passing variables to template
  • Date: Fri, 7 Feb 2014 12:40:22 -0800

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


On Fri, Feb 7, 2014 at 12:18 PM, Mark H. Nichols < " target="_blank"> > 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 








Archive powered by MHonArc 2.6.16.

§