0
我想創建一個自定義的廚師資源;並開始我基本上是一個hello世界的例子,不適合我。看起來很簡單;所以我不明白我做錯了什麼。簡單的廚師資源不包括
我有一個叫做 '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
這裏是我與運行配方得到錯誤
[email protected]:/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 [[email protected]]
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)
看來,它無法找到 '節點' 資源;但據我瞭解,它應該作爲食譜的一部分自動加載。
任何幫助,將不勝感激。
也可以在你的食譜中使用'default',你可以使用菜譜名稱作爲LWRP資源名稱。 – 2014-08-27 21:45:05