Error with chef-solo installs: block in from_file

I have found that when you run into an error like this, it helps if you use “sudo”. 🙂 the error is slightly misleading. I kept looking at the code on line 22 and could not figure out what was so wrong. After i took a break and came back to this I noticed further down in package.rb this bit of code:

template "#{node['php']['conf_dir']}/php.ini" do
 source "php.ini.erb"
 owner "root"
 group "root"
 mode "0644"
 variables(:directives => node['php']['directives'])

That’s when I realized I should be running this as sudo…worked like a charm. Live and learn.

Here’s the original error:

[seth@lab001 chef-repo]$ chef-solo -c solo.rb -j php.json
Starting Chef Client, version 11.6.0
Compiling Cookbooks...
Converging 7 resources
Recipe: php::package
 * package[php] action install
Error executing action `install` on resource 'package[php]'

 returned 1, expected 0

Resource Declaration:
# In /home/seth/chef-repo/cookbooks/php/recipes/package.rb
22: package pkg do
 23: action :install
 24: end
 25: end

Compiled Resource:
# Declared in /home/seth/chef-repo/cookbooks/php/recipes/package.rb:22:in `block in from_file'
package("php") do
 action [:install]
 retries 0
 retry_delay 2
 package_name "php"
 version "5.3.3-23.el6_4"
 cookbook_name :php
 recipe_name "package"

[2013-09-23T13:36:49-04:00] ERROR: Running exception handlers
[2013-09-23T13:36:49-04:00] ERROR: Exception handlers complete
[2013-09-23T13:36:49-04:00] FATAL: Stacktrace dumped to /home/seth/chef-repo/chef-solo/chef-stacktrace.out
Chef Client failed. 0 resources updated
[2013-09-23T13:36:49-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)