也许有人面临同样的情况
我们在redis上有一个干净的实例,他试图放一个厨师 默认配方只有
include_recipe“redisio :: install”
当我做饭时出现以下错误 Enviroment AWS ec2.micro ubuntu 12.04 当我运行cook以收到错误
================================================================================
Recipe Compile Error in /tmp/chef-solo/cookbooks/main/recipes/default.rb
================================================================================
NoMethodError
-------------
undefined method `[]' for nil:NilClass
Cookbook Trace:
---------------
/tmp/chef-solo/cookbooks/ulimit/recipes/default.rb:13:in `block in from_file'
/tmp/chef-solo/cookbooks/ulimit/recipes/default.rb:12:in `from_file'
/tmp/chef-solo/cookbooks/redisio/recipes/install.rb:20:in `from_file'
/tmp/chef-solo/cookbooks/main/recipes/default.rb:11:in `from_file'
Relevant File Content:
----------------------
/tmp/chef-solo/cookbooks/ulimit/recipes/default.rb:
6: # All rights reserved - Do Not Redistribute
7: #
8: ulimit = node['ulimit']
9:
10: case node[:platform]
11: when "debian", "ubuntu"
12: template "/etc/pam.d/su" do
13>> cookbook ulimit['pam_su_template_cookbook']
14: end
15: end
16:
[2013-04-06T14:09:50+00:00] ERROR: Running exception handlers
[2013-04-06T14:09:50+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated
[2013-04-06T14:09:50+00:00] FATAL: Stacktrace dumped to /tmp/chef-solo/chef-stacktrace.out
[2013-04-06T14:09:50+00:00] FATAL: NoMethodError: undefined method `[]' for nil:NilClass
ERROR: RuntimeError: chef-solo failed. See output above.
答案 0 :(得分:1)
我也遇到了这个问题。我有一种方法可以解决它,但我也刚开始研究厨师。
问题是redisio取决于ulimit,当你没有定义ulimit的任何属性时,看起来配方不能处理。
ulimit = node['ulimit']
尝试获取属性的哈希,但是获得了nil。因此,如果您定义了一些属性,它应该可以工作。
自您下载以来,可能会有更新版本的配方。如果不在ulimit/attributes/default.rb
我default['ulimit']['pam_su_template_cookbook'] = nil
,那对我有用。
ulimit让你限制资源。我认为它可以用来限制redis资源。 (我也是新人。)所以更好的方法可能是如何配置ulimit并设置正确的属性而不是nil