NoMethodError:未定义的方法`connect' for Chef :: Resource :: File

时间:2015-11-26 01:28:21

标签: ruby chef chef-recipe

我正在尝试按照网站上的教程

学习厨师自动化

https://learn.chef.io/learn-the-basics/rhel/configure-a-resource/

centos 7 0.10和0.09版本给我这个错误,当我试图按照简单的练习,但我得到了跟随错误。

[我正在尝试第一个厨师所以真的不知道我在做什么,任何人都可以给我任何提示或建议它是有帮助的]

[root@centos-7 chef-repo]# chef-apply hello.rb
[2015-11-25T04:29:27-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2015-11-25T04:29:27-05:00] FATAL: NoMethodError: undefined method `connect' for Chef::Resource::File
[root@centos-7 chef-repo]# cat /var/chef/cache/chef-stacktrace.out
Generated at 2015-11-25 04:29:27 -0500
NoMethodError: undefined method `connect' for Chef::Resource::File
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource.rb:1576:in `method_missing'
hello.rb:2:in `block in run_chef_recipe'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource_builder.rb:77:in `instance_eval'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource_builder.rb:77:in `build'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/dsl/recipe.rb:108:in `build_resource'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/dsl/recipe.rb:69:in `declare_resource'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/dsl/resources.rb:15:in `file'
hello.rb:1:in `run_chef_recipe'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application/apply.rb:186:in `instance_eval'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application/apply.rb:186:in `run_chef_recipe'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application/apply.rb:198:in `run_application'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application/apply.rb:211:in `run'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/bin/chef-apply:25:in `<top (required)="">'
/usr/bin/chef-apply:54:in `load'
/usr/bin/chef-apply:54:in `<main>'[root@centos-7 chef-repo]#

1 个答案:

答案 0 :(得分:2)

如果我不得不猜测你错误contentconnect