【发布时间】:2014-08-28 05:55:33
【问题描述】:
我正在尝试创建自定义厨师资源;首先,我基本上有一个不适合我的 hello world 示例。看起来很简单;所以我不明白我做错了什么。
我有一本名为“couchbase”的食谱,其目录结构如下
couchbase
resources
nodes.rb
providers
nodes.rb
recipes
default.rb
这是文件
default.rb
nodes "update" do
end
nodes.rb(资源)
actions :update
default_action :update
nodes.rb(提供者)
def whyrun_supported?
true
end
use_inline_resources
action :update do
Chef::Log.info "Success in loading resource"
end
这是我在运行配方时遇到的错误
vagrant@precise64:/var/chef/cache/cookbooks/couchbase$ sudo chef-client -l info
[2014-08-27T21:04:57+00:00] INFO: Forking chef instance to converge...
[2014-08-27T21:04:57+00:00] WARN:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
SSL validation of HTTPS requests is disabled. HTTPS connections are still
encrypted, but chef is not able to detect forged replies or man in the middle
attacks.
To fix this issue add an entry like this to your configuration file:
```
# Verify all HTTPS connections (recommended)
ssl_verify_mode :verify_peer
# OR, Verify only connections to chef-server
verify_api_cert true
```
To check your SSL configuration, or troubleshoot errors, you can use the
`knife ssl check` command like so:
```
knife ssl check -c /etc/chef/client.rb
```
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Starting Chef Client, version 11.14.6
[2014-08-27T21:04:57+00:00] INFO: *** Chef 11.14.6 ***
[2014-08-27T21:04:57+00:00] INFO: Chef-client pid: 4377
[2014-08-27T21:04:58+00:00] INFO: Run List is [recipe[couchbase]]
[2014-08-27T21:04:58+00:00] INFO: Run List expands to [couchbase]
[2014-08-27T21:04:58+00:00] INFO: Starting Chef Run for client1
[2014-08-27T21:04:58+00:00] INFO: Running start handlers
[2014-08-27T21:04:58+00:00] INFO: Start handlers complete.
[2014-08-27T21:04:58+00:00] INFO: HTTP Request Returned 404 Object Not Found:
resolving cookbooks for run list: ["couchbase"]
[2014-08-27T21:04:58+00:00] INFO: Loading cookbooks [couchbase@0.1.0]
Synchronizing Cookbooks:
[2014-08-27T21:04:58+00:00] INFO: Storing updated cookbooks/couchbase/recipes/default.rb in the cache.
- couchbase
Compiling Cookbooks...
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/couchbase/recipes/default.rb
================================================================================
NoMethodError
-------------
No resource or method named `nodes' for `Chef::Recipe "default"'
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/couchbase/recipes/default.rb:5:in `from_file'
Relevant File Content:
----------------------
/var/chef/cache/cookbooks/couchbase/recipes/default.rb:
1: #
2: # Cookbook Name:: couchbase
3: # Recipe:: default
4: #
5>> nodes "update" do
6:
7: end 8:
Running handlers:
[2014-08-27T21:04:58+00:00] ERROR: Running exception handlers
Running handlers complete
[2014-08-27T21:04:58+00:00] ERROR: Exception handlers complete
[2014-08-27T21:04:58+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 1.767735946 seconds
[2014-08-27T21:04:58+00:00] ERROR: No resource or method named `nodes' for `Chef::Recipe "default"'
[2014-08-27T21:04:58+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
似乎找不到“节点”资源;但据我了解,它应该作为食谱的一部分自动加载。
任何帮助将不胜感激。
【问题讨论】:
标签: ruby chef-infra chef-recipe