我正在使用 Chef-solo 并使用 berkshelf 维护社区 Recipe 。最近使用berkshelf安装了iptables Recipe ,当我运行chef-solo时它抛出了以下错误。
RuntimeError
------------
File templates/default/rebuild-iptables.erb does not exist for cookbook iptables
Resource Declaration:
---------------------
# In /home/directfn/.berkshelf/cookbooks/iptables-2.0.1/recipes/default.rb
35: template '/usr/sbin/rebuild-iptables' do
36: source 'rebuild-iptables.erb'
37: mode '0755'
38: variables(
39: hashbang: ::File.exist?('/usr/bin/ruby') ? '/usr/bin/ruby' : '/opt/chef/embedded/bin/ruby'
40: )
41: end
42:
但我可以看到模板源就在那里。
[root@euca-172-16-10-197 chef-repo]# ls /home/directfn/.berkshelf/cookbooks/iptables-2.0.1/templates/default/rebuild-iptables.erb
/home/directfn/.berkshelf/cookbooks/iptables-2.0.1/templates/default/rebuild-iptables.erb
但是如果我将 iptables Recipe 复制到我剩余的 Recipe 所在的位置,它就像一个魅力。 我正在使用 30 多本使用 Berkshelf 的其他社区 Recipe ,没有任何问题。
有人知道这里发生了什么吗?
提前致谢
solo.rb 文件
file_cache_path "/home/directfn/devops/chef-solo"
cookbook_path [
"/home/directfn/devops/chef-repo/cookbooks",
"/home/directfn/.berkshelf/cookbooks"
]
data_bag_path "/home/directfn/devops/chef-repo/data_bags"
environment "development"
environment_path "/home/directfn/devops/chef-repo/environments"
Json 属性文件:
{
"name": "phoenix_new",
"description": "",
"java": {
"install_flavor": "oracle",
"jdk_version": 7,
"oracle": {
"accept_oracle_download_terms": true
}
},
"phoenix": {
"tag": "dbfs_release_0"
},
"run_list": [
"recipe[phoenix::simple]"
],
"env_run_lists": {
}
}
最佳答案
chef-solo
无法直接使用 .berkshelf/
下的 Recipe 。您应该使用 berksvendor
将它们重新格式化为 Chef 可以更好处理的结构。
关于chef-infra - 使用 Berkshelf 时无法找到 Recipe 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34058731/