2017-06-18 87 views
1

我想在食譜中運行我的食譜之一。廚師無法找到它。以下是我的樹。我嘗試的命令是廚師無法解決我的食譜名稱。即使名稱是錯誤的

sudo chef-client --local-mode -runlist "recipe[apache::server]" 

我甚至與食譜

sudo chef-client --local-mode -runlist "recipe[cookbooks/apache::server]" 

的路徑嘗試下面是我的錯誤。奇怪的是,它在錯誤中顯示的食譜名稱是unlist,這不是我的食譜名稱。我的食譜名稱是apache

[[email protected] ~]$ sudo chef-client --local-mode -runlist "recipe[apache::server]" 
[2017-06-18T07:24:32+00:00] WARN: No config file found or specified on command line, using command line options. 
Starting Chef Client, version 12.14.89 
resolving cookbooks for run list: ["unlist"] 

================================================================================ 
Error Resolving Cookbooks for Run List: 
================================================================================ 

Missing Cookbooks: 
------------------ 
No such cookbook: unlist 

Expanded Run List: 
------------------ 
* unlist 

Platform: 
--------- 
x86_64-linux 


Running handlers: 
[2017-06-18T07:24:34+00:00] ERROR: Running exception handlers 
Running handlers complete 
[2017-06-18T07:24:34+00:00] ERROR: Exception handlers complete 
Chef Client failed. 0 resources updated in 01 seconds 
[2017-06-18T07:24:34+00:00] FATAL: Stacktrace dumped to /root/.chef/local-mode-cache/cache/chef-stacktrace.out 
[2017-06-18T07:24:34+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report 
[2017-06-18T07:24:34+00:00] ERROR: 412 "Precondition Failed" 
[2017-06-18T07:24:34+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1) 

樹結構

[[email protected] ~]$ tree 
. 
|-- cookbooks 
| `-- apache 
|  |-- Berksfile 
|  |-- chefignore 
|  |-- metadata.rb 
|  |-- README.md 
|  |-- recipes 
|  | |-- default.rb 
|  | `-- server.rb 
|  |-- spec 
|  | |-- spec_helper.rb 
|  | `-- unit 
|  |  `-- recipes 
|  |   |-- default_spec.rb 
|  |   `-- server_spec.rb 
|  `-- test 
|   `-- recipes 
|    |-- default_test.rb 
|    `-- server.rb 
|-- delete.rb 
|-- hello.rb 
|-- hellotodelet.rb 
`-- nodes 
    `-- localhost.json 

回答

1

問題是你有一個破折號-runlist,你需要兩個破折號:--runlist

+0

是的,我後來發現並意識到我的錯誤。日Thnx – user3310115

0

好了,所以我想我找到了答案,但部分。所以我已經單獨執行食譜而不使用runlist。因此,該軟件包已安裝並且服務已啓動並正在運行。

sudo chef-client --local-mode cookbooks/apache/server.rb 

所以它不工作。不知道爲什麼。我認爲這些食譜應該是冪等的。無論如何,所以後來我寫了另一個配方來卸載並禁用包&服務。當我重新運行server.rb時,它工作。

雖然仍然不確定,但它無法第一次選擇。一次又一次地運行它使得它以同樣的方式工作。所以在執行單個配方和執行食譜中的配方之間必定存在一些差異。

+0

這是不正確的,你只是側面問題。 – coderanger