【问题标题】:Could not find recipe from cookbook when running chef-client运行厨师客户端时无法从食谱中找到食谱
【发布时间】:2016-10-19 00:06:18
【问题描述】:

我正在尝试使用 chef-client 在独立系统上测试食谱,但以下命令不断出错。

我可以使用

运行 default.rb
sudo chef-client -z -o "recipe[kafkaSetup]"

但是当我运行另一个配方时,我收到如下命令的错误。

sudo chef-client -z -o "recipe[kafkaSetup::reBalanceCluster.rb]"
[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)

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

【问题讨论】:

    标签: chef-infra chef-recipe


    【解决方案1】:

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

    sudo chef-client -z -o "recipe[kafkaSetup::reBalanceCluster]"
    

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

    sudo chef-client -z -o "recipe[kafkaSetup::rebalancecluster]"
    

    【讨论】:

      猜你喜欢
      • 2021-11-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-04
      • 2019-01-29
      • 1970-01-01
      • 1970-01-01
      • 2020-01-06
      • 1970-01-01
      相关资源
      最近更新 更多