[chef] Noob Alert: languages attribute?


Chronological Thread 
  • From: Andreas Kollegger < >
  • To:
  • Subject: [chef] Noob Alert: languages attribute?
  • Date: Fri, 28 Jan 2011 11:12:04 +0100

Hi all,

I've just started writing a chef cookbook for provisioning Neo4j. It's naive 
but functional at the moment. In studying and trying out other cookbooks, I 
had a problem with the tomcat6.

This chunk of code...

if languages[:java]
  set_unless[:tomcat6][:with_snmp]      = 
!languages[:java][:runtime][:name].match(/^OpenJDK/)
else
  set_unless[:tomcat6][:with_snmp]      = false
end

Caused a problem because languages[:java][:runtime] does not exist. Browsing 
with `shef` I discovered this...

chef:attributes > languages[:java][:hotspot][:name]
 => "OpenJDK Client VM" 

So, I modified the check for OpenJDK to look like this...

if languages[:java][:runtime]
  set_unless[:tomcat6][:with_snmp]      = 
!languages[:java][:runtime][:name].match(/^OpenJDK/)
elsif languages[:java][:hotspot]
  set_unless[:tomcat6][:with_snmp]      = 
!languages[:java][:hotspot][:name].match(/^OpenJDK/)
else
  set_unless[:tomcat6][:with_snmp]      = false
end

Which works but seems a bit hack-ish. Is there a predictable structure to the 
languages[:java] attribute? What creates it? 

Cheers,
Andreas




Archive powered by MHonArc 2.6.16.

§