Le 28 juin 2015 21:18, Kurt Andrews <
> a écrit :
>
> I'v only been using chef for a few hours, and the learning curve seemed really easy until...
>
> I'm trying to right a recipe that installs several software packages on an Ubuntu 12.04 virtual machine. The first thing it needs to do is install Oracle JDK 7. I decided to try to use the java cookbook in the Chef Supermarket. after looking at the documentation, I added a base role to my cookbook that looks like this (base.rb):
Unless you stated an error there, you problem is here, a role is something aside the cookbook, not within. It's part of the runlist. I'm not comfortable to give links from phone, try a search on http://docs.chef.io for the node runlist, roles and cookbook and feel free to ping the list back with details of your cookbook and what you did ;)
>
> name "java"
> description "Install Oracle Java on Ubuntu"
> override_attributes(
> "java" => {
> "jdk_version" => '7'
> "install_flavor" => "oracle"
> "oracle" => {
> "accept_oracle_download_terms" => true
> }
> }
> )
> run_list(
> "recipe[java]"
> )
>
> I expected the run list to execute the java::default recipe when chef_zero ran mine. That didn't happen. I added the following line to my recipe, the only thing in my default.rb at the moment:
>
> include_recipe "java"
>
> That got me a little farther. I'm now getting the following output when I vagrant up:
>
> ==> default: 27: include_recipe "java::set_attributes_from_version"
> ==> default: 28: include_recipe "java::#{node['java']['install_flavor']}"
> ==> default: 29:
> ==> default:
> ==> default: [2015-06-28T11:27:27-07:00] ERROR: Running exception handlers
> ==> default: [2015-06-28T11:27:27-07:00] ERROR: Exception handlers complete
> ==> default: [2015-06-28T11:27:27-07:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
> ==> default: [2015-06-28T11:27:27-07:00] ERROR: undefined method `[]' for nil:NilClass
> ==> default: [2015-06-28T11:27:28-07:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
>
> chef-stacktrace.out points to line 21 of java::default.rb
>
> First and foremost, what am I missing? Something isn't getting defined, but I can't tell what it is, or where to define it.
>
> The second question is what is the run_list for in a role, and when does it get processed? What kicks it off?
>
> Thanks in advance for straightening me out.
>
> Regards,
>
> Kurt
>
Archive powered by MHonArc 2.6.16.