Reputation: 6328
While running a recipe for Pyramid, the following is failing in chef-solo
:
================================================================================
Error executing action `create` on resource 'directory[/etc/service/pyramid/supervise/status]'
================================================================================
NoMethodError
-------------
undefined method `checksum' for Chef::Resource::Directory
Resource Declaration:
---------------------
# In /var/chef-solo/cookbooks/project/recipes/pyramid.rb
22: directory "#{node['runit']['service_dir']}/pyramid#{dir}/supervise/#{f}" do
23: owner login
24: group login
25: end
26: end
Compiled Resource:
------------------
# Declared in /var/chef-solo/cookbooks/project/recipes/pyramid.rb:22:in `block (2 levels) in from_file'
directory("/etc/service/pyramid/supervise/status") do
provider Chef::Provider::Directory
action :create
retries 0
retry_delay 2
path "/etc/service/pyramid/supervise/status"
cookbook_name :project
recipe_name "pyramid"
owner "myusername"
group "myusername"
mode 420
end
Why is this getting "undefined method checksum
" and what can I do about it?
This error doesn't appear to be consistent. Sometimes the chef run appears to hang. Other times, after multiple runs, chef is able to pass this point.
I'm running on a vanilla Ubuntu server 12.04LTS with chef installed with a deploy script:
sudo apt-get install -y ruby1.9.1 ruby1.9.1-dev make &&
sudo gem1.9.1 install chef ohai --no-rdoc --no-ri
This is the full Pyramid recipe:
login = node["user"]["login"]
home = node["user"]["home"]
app_root = node["user"]["app_root"]
runit_service "pyramid" do #, :template_name => "site" do
template_name "pyramid"
owner login
group login
options({
:login => login,
:app_root => app_root,
:home => home,
:config => "#{app_root}/config/gunicorn.conf.py"
})
end
["", "/log"].each do |dir|
directory "#{node['runit']['service_dir']}/pyramid#{dir}/supervise" do
mode "0755"
end
%w(ok control status).each do |f|
directory "#{node['runit']['service_dir']}/pyramid#{dir}/supervise/#{f}" do
owner login
group login
end
end
end
Upvotes: 2
Views: 2116
Reputation: 6328
This was my solution - found after some hacking around plus the tip from @Draco-ater...
Where the recipe referenced directory("/etc/service/pyramid/supervise/status")
, the status 'directory' is a file that already exists which was causing issues.
In addition, the script also tried to update the control
and ok
pipes as directories - which was also failing. I solved this by using bash
and chmod
:
bash "give_perms_pyramid" do
user "chef"
cwd "#{node['runit']['service_dir']}/pyramid#{dir}/supervise"
code <<-EOH
sudo chown myuser:root control
sudo chmod g+rw control
EOH
Maybe that will help someone.
Upvotes: 3