我的厨师最近跑了这个错误:
Chef Client failed. 22 resources updated in 90.306407696 seconds
[2014-12-19T19:47:24+00:00] ERROR: cookbook_file[/srv/mycookbook/static/a.png] (mycookbook::_deploy line 82) had an error: Chef::Exceptions::FileNotFound: Cookbook 'mycookbook' (0.4.5) does not contain a file at any of these locations:
files/ubuntu-12.04/static/a.png
files/ubuntu/static/a.png
files/default/static/a.png
This cookbook _does_ contain: ['a.css','b.html','c.html']
那是因为主要食谱mycookbook
(我不拥有)有以下几行:
node['myattributes']['theme']['static_files'].each do |file|
cookbook_file node['myattributes']['install_dir'] + "/static/" + file do
source "static/#{file}"
owner node['myattributes']['user']
group node['myattributes']['group']
cookbook node['myattributes']['theme']['source_cookbook']
end
end
但是我的孩子或使用mycookbook
的封面食谱的这些行具有不同的属性并且失败了:
override['myattributes']['theme']['compile_files'] = ['a.html']
override['myattributes']['theme']['static_files'] = ['a.png']
我将这些文件存储在我的包装食谱files/default/static/
和files/default/etc/
我已经知道问题所在。我的封面食谱没有mycookbook
预期的一些文件,但为什么我呢?无论如何都应该覆盖这些属性。
我的问题是有更好的方法来处理在files/default
下检查的文件,在父级食谱中定义了食谱定义,而包装器食谱只是用不同的文件定义了不同的属性集?
答案 0 :(得分:1)
你需要将node['myattributes']['theme']['source_cookbook']
设置为`然后将你的包装食谱的名称设置为正确的食谱。