gpt4 book ai didi

checksum - Chef::Resource::Directory 的未定义方法 `checksum'

转载 作者:行者123 更新时间:2023-12-04 05:21:51 28 4
gpt4 key购买 nike

在运行金字塔配方时,以下在 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

最佳答案

这是我的解决方案 - 经过一些黑客攻击以及@Draco-ater 的提示后发现的...

配方引用的地方 directory("/etc/service/pyramid/supervise/status") ,状态“目录”是一个已经存在的文件,它导致了问题。

此外,脚本还尝试更新controlok管道作为目录 - 这也失败了。我通过使用 bash 解决了这个问题和 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

也许这会帮助某人。

关于checksum - Chef::Resource::Directory 的未定义方法 `checksum',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13603912/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com