2012-11-28 40 views
2

雖然運行金字塔配方,在失敗中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 

這是爲什麼會出現‘未定義的方法checksum’和我能做什麼?

此錯誤似乎不一致。有時廚師長跑似乎掛起。其他時候,多次運行後,廚師可以通過這一點。

我在香草Ubuntu的服務器運行12.04LTS與一個部署腳本安裝廚師:

sudo apt-get install -y ruby1.9.1 ruby1.9.1-dev make && 
sudo gem1.9.1 install chef ohai --no-rdoc --no-ri 

這是一個完整的金字塔食譜:

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 
+0

不是真正的金字塔框架的具體,是嗎? –

+0

有相當多的廚師食譜,你可以通過並刪除技術的目標,如果你在編輯心情 - http://stackoverflow.com/questions/tagged/recipe – jamesc

+0

'食譜'聽起來像一個候選人burniating;這是非常元。 –

回答

3

這是我的解決方案 - 發現在一些黑客入侵之後加上@Draco-ater的提示...

如果配方參考directory("/etc/service/pyramid/supervise/status"),狀態'目錄'是一個已經存在的文件,其中w作爲導致問題。

此外,腳本還嘗試將controlok管道更新爲目錄 - 這也失敗了。我解決了這個利用bashchmod

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 

也許這將幫助別人。