我是厨师新手,开始使用用户库编写一个简单的食谱。我的 Berks 文件:
name@name:~/chef-repo$ cat Berksfile
site :opscode
cookbook "users"
然后我跑了:
berks install
和我的食谱:
name@name:~/chef-repo$ ls cookbooks/
users
最后是我的食谱:
name@name:~/chef-repo$ cat blah-users.rb
include_recipe "users"
users_manage "blah-dev" do
group_id 1001
action [ :remove, :create ]
end
当我申请时,我收到一个错误:
name@name:~/chef-repo$ chef-apply blah-users.rb
[2015-05-04T09:05:48-04:00] FATAL: Stacktrace dumped to /home/name/.chef/cache/chef-stacktrace.out
[2015-05-04T09:05:48-04:00] FATAL: NoMethodError: undefined method `unreachable_cookbook?' for nil:NilClass
我相当肯定include_recipe “用户”是问题(至少是第一个)。我还发现这一行Stacktrace 转储到 /home/name/.chef/cache/chef-stacktrace.out很有趣,因为该位置没有文件。
我尝试过使用和不使用 sudo。所以我认为这不是权限问题。
我正在运行本地安装的厨师服务器 12.3,它看起来运行良好......
谢谢
~/chef-repo$ sudo chef-apply blah-users.rb -l debug
[2015-05-04T13:17:50-04:00] DEBUG: Building node object for tbrown
[2015-05-04T13:17:50-04:00] DEBUG: Extracting run list from JSON attributes provided on command line
[2015-05-04T13:17:50-04:00] DEBUG: Applying attributes from json file
[2015-05-04T13:17:50-04:00] DEBUG: Platform is ubuntu version 14.04
[2015-05-04T13:17:50-04:00] INFO: Run List is []
[2015-05-04T13:17:50-04:00] INFO: Run List expands to []
[2015-05-04T13:17:50-04:00] DEBUG: Loading Recipe users via include_recipe
[2015-05-04T13:17:50-04:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2015-05-04T13:17:50-04:00] DEBUG: NoMethodError: undefined method `unreachable_cookbook?' for nil:NilClass
/opt/chefdk/embedded/apps/chef/lib/chef/run_context.rb:257:in `unreachable_cookbook?'
/opt/chefdk/embedded/apps/chef/lib/chef/run_context.rb:155:in `load_recipe'
/opt/chefdk/embedded/apps/chef/lib/chef/run_context.rb:142:in `block in include_recipe'
/opt/chefdk/embedded/apps/chef/lib/chef/run_context.rb:141:in `each'
/opt/chefdk/embedded/apps/chef/lib/chef/run_context.rb:141:in `include_recipe'
/opt/chefdk/embedded/apps/chef/lib/chef/dsl/include_recipe.rb:26:in `include_recipe'
blah-users.rb:1:in `run_chef_recipe'
/opt/chefdk/embedded/apps/chef/lib/chef/application/apply.rb:168:in `instance_eval'
/opt/chefdk/embedded/apps/chef/lib/chef/application/apply.rb:168:in `run_chef_recipe'
/opt/chefdk/embedded/apps/chef/lib/chef/application/apply.rb:180:in `run_application'
/opt/chefdk/embedded/apps/chef/lib/chef/application/apply.rb:193:in `run'
/opt/chefdk/embedded/apps/chef/bin/chef-apply:25:in `<top (required)>'
/usr/bin/chef-apply:51:in `load'
/usr/bin/chef-apply:51:in `<main>'
[2015-05-04T13:17:50-04:00] FATAL: NoMethodError: undefined method `unreachable_cookbook?' for nil:NilClass