运行厨师客户端时无法从食谱中找到食谱

Jua*_*ews 2 chef-infra chef-recipe

我正在尝试使用 Chef-client 在独立系统上测试食谱,但一直收到以下命令的错误。

我可以通过使用运行 default.rb

sudo chef-client -z -o "recipe[kafkaSetup]"
Run Code Online (Sandbox Code Playgroud)

但是,当我运行另一个配方时,出现以下命令的错误。

sudo chef-client -z -o "recipe[kafkaSetup::reBalanceCluster.rb]"
Run Code Online (Sandbox Code Playgroud)
[2016-10-18T06:09:33-04:00] WARN: No config file found or specified on command line, using command line options.
Starting Chef Client, version 12.12.15
[2016-10-18T06:09:37-04:00] WARN: Run List override has been provided.
[2016-10-18T06:09:37-04:00] WARN: Original Run List: []
[2016-10-18T06:09:37-04:00] WARN: Overridden Run List: [recipe[kafkaSetup::reBalanceCluster.rb]]
resolving cookbooks for run list: ["kafkaSetup::reBalanceCluster.rb"]
Synchronizing Cookbooks:
  - kafkaSetup (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...

================================================================================
Recipe Compile Error
================================================================================

Chef::Exceptions::RecipeNotFound
--------------------------------
could not find recipe reBalanceCluster.rb for cookbook kafkaSetup

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


Running handlers:
[2016-10-18T06:09:37-04:00] ERROR: Running exception handlers
Running handlers complete
[2016-10-18T06:09:37-04:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 04 seconds
[2016-10-18T06:09:37-04:00] FATAL: Stacktrace dumped to /root/.chef/local-mode-cache/cache/chef-stacktrace.out
[2016-10-18T06:09:37-04:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-10-18T06:09:37-04:00] ERROR: could not find recipe reBalanceCluster.rb for cookbook kafkaSetup
[2016-10-18T06:09:39-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited
unsuccessfully (exit code 1)
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?任何帮助,将不胜感激。

Ste*_*ing 5

配方名称不包括文件扩展名 ( .rb),因此在指定运行列表时必须省略它:

sudo chef-client -z -o "recipe[kafkaSetup::reBalanceCluster]"
Run Code Online (Sandbox Code Playgroud)

这假设有一个文件recipes/reBalanceCluster.rb。为了保存,我还建议在任何地方都使用小写字母。那可能根本行不通。所以最好将文件重命名为rebalancecluster.rb并使用:

sudo chef-client -z -o "recipe[kafkaSetup::rebalancecluster]"
Run Code Online (Sandbox Code Playgroud)