[chef] Re: Re: Using Chef to install Java (my first recipe)


Chronological Thread 
  • From: phil swenson < >
  • To:
  • Subject: [chef] Re: Re: Using Chef to install Java (my first recipe)
  • Date: Thu, 13 Mar 2014 20:06:36 -0600


On Thu, Mar 13, 2014 at 5:37 PM, Christopher Armstrong < " target="_blank"> > wrote:
node['java']['install_flavor'] = 'oracle'

Which file do I set “node['java']['install_flavor'] = ‘oracle’”??

this is something fundamental to chef I don’t get. I tried setting this in main/recipes/default.rb but node evaluates to nil.

thanks
phil

error:

NoMethodError
-------------
undefined method `[]' for nil:NilClass


Cookbook Trace:
---------------
  /root/chef-solo/cookbooks-2/java/recipes/set_attributes_from_version.rb:22:in `from_file'
  /root/chef-solo/cookbooks-2/java/recipes/default.rb:21:in `from_file'
  /root/chef-solo/cookbooks-2/main/recipes/default.rb:11:in `from_file'


Relevant File Content:
----------------------
/root/chef-solo/cookbooks-2/java/recipes/set_attributes_from_version.rb:

 15:
 16:  # Calculate variables that depend on jdk_version
 17:  # If you need to override this in an attribute file you must use
 18:  # force_default or higher precedence.
 19:
 20:  case node['platform_family']
 21:  when "rhel", "fedora"
 22>>   case node['java']['install_flavor']
 23:    when "oracle"
 24:      node.default['java']['java_home'] = "/usr/lib/jvm/java"
 25:    when "oracle_rpm"
 26:      node.default['java']['java_home'] = "/usr/java/latest"
 27:    else
 28:      node.default['java']['java_home'] = "/usr/lib/jvm/java-1.#{node['java']['jdk_version']}.0"
 29:    end
 30:    node.default['java']['openjdk_packages'] = ["java-1.#{node['java']['jdk_version']}.0-openjdk", "java-1.#{node['java']['jdk_version']}.0-openjdk-devel"]
 31:  when "freebsd"




Archive powered by MHonArc 2.6.16.

§