食谱中的厨师错误。带刀的菜谱不见了

Chef error in Cookbook. Missing cookbook with knife

我是 Chef 世界的新手,目前正在尝试编写一本食谱,其中包含一个食谱,用于在 windows 服务器上安装 Nagios NRPE。我在配方中包含了一个 bash 脚本来执行一组命令。

然而,当我 运行 kitchen converge 时,我不断收到以下错误。我在 "recipie" 中尝试了很多变体,浏览了堆栈溢出和其他不起作用的在线论坛

请帮忙。

如果需要任何其他详细信息,请告诉我

食谱

 execute 'setup.bash' do     
 cwd '\templates\Setup.bash.sh'  
 command './setup.bash.sh' end

错误

> ================================================================================
>        Error Resolving Cookbooks for Run List:
>        ================================================================================
> 
>        Missing Cookbooks:
>        ------------------
>        No such cookbook: Nagios_NRPE
> 
>        Expanded Run List:
>        ------------------
>        * Nagios_NRPE::default
> 
>        System Info:
>        ------------
>        chef_version=15.3.14
>        platform=windows
>        platform_version=6.2.9200
>        ruby=ruby 2.6.4p104 (2019-08-28 revision 67798) [x64-mingw32]
>        program_name=C:/opscode/chef/bin/chef-client
>        executable=C:/opscode/chef/bin/chef-client
> 
> 
>        Running handlers:
>        [2019-10-14T00:18:38+00:00] ERROR: Running exception handlers
>        Running handlers complete
>        [2019-10-14T00:18:38+00:00] ERROR: Exception handlers complete
>        Chef Infra Client failed. 0 resources updated in 04 seconds
>        [2019-10-14T00:18:38+00:00] FATAL: Stacktrace dumped to /kitchen/cache/chef-stacktrace.out
>        [2019-10-14T00:18:38+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
>        [2019-10-14T00:18:38+00:00] FATAL: Net::HTTPServerException: 412 "Precondition Failed"
> >>>>>> ------Exception-------
> >>>>>> Class: Kitchen::ActionFailed
> >>>>>> Message: 1 actions failed.
> >>>>>>     Converge failed on instance <default-windows-2012>.  Please see .kitchen/logs/default-windows-2012.log for more details
> >>>>>> ----------------------
> >>>>>> Please see .kitchen/logs/kitchen.log for more details

确保在说明书中声明说明书依赖项 metadata.rb,例如

# metadata.rb
depends "Nagios_NRPE"

虽然,您的意思似乎是 nrpe 而不是 Nagios_NRPE

确保 knife cookbooks_path 配置正确。

现在取决于您如何处理说明书依赖项,无论是 chef (using a Policyfile or berkshelf(使用 Berksfile),确保下载说明书依赖项。