2013-04-06 134 views
0

也许有人面临着同样的情况厨师和redissio错误

我们对Redis的谁试图把厨师 默认配方干净的实例只有

include_recipe“redisio ::安装”

当我做饭收到以下错误 环境AWS ec2.micro的Ubuntu 12.04 当我运行做饭收到错误

================================================================================ 
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. 

资源https://github.com/Piom/redis-chef.git

回答

1

我也遇到过这个问题。我有办法解决这个问题,但我也开始考虑厨师。

问题是redisio取决于ulimit,看起来像配方不处理,当你没有任何ulimit属性定义。

ulimit = node['ulimit'] 

尝试获取属性的哈希值,但得到零。所以如果你定义了一些属性,它应该可以工作

自从您下载配方后,可能会有配方的更新版本。如果不在ulimit/attributes/default.rb我有default['ulimit']['pam_su_template_cookbook'] = nil它对我有用。

ulimit让你限制资源。我认为它可以用来限制redis资源。 (同样我也是新的)。所以更好的方法可能是如何配置ulimit并设置正确的属性,而不是零。