【发布时间】:2023-04-05 23:39:01
【问题描述】:
我的厨师跑步最近抛出了这个错误:
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 下检查的文件,即配方定义是在父说明书中定义的,而包装说明书只是用不同的文件定义不同的属性集?
【问题讨论】:
标签: chef-infra chef-recipe cookbook