2017-06-18 77 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