ruby - Chef Recipe 错误 : Error Resolving Cookbooks for Run List

标签 ruby git chef-infra riak knife

我已经通过 knife 安装了以下 Recipe :

for cb in apt build-essential erlang java sysctl git ulimit yum yum-epel packagecloud riak curl ; do knife cookbook site install $cb; done;

现在,当我运行 sudo chef-client --local-mode --runlist 'recipe[riak]' 时,我收到一个错误,提示 git 依赖。但是,riak Recipe 包含 "git": "~> 3.0",

安装的 git 说明书是这个版本:

$ cat /root/chef-repo/cookbooks/git/metadata.rb | grep version
version           '4.0.2'

这是命令的实际错误:

$ sudo chef-client --local-mode --runlist 'recipe[riak]'
Starting Chef Client, version 11.18.0.rc.1
resolving cookbooks for run list: ["riak"]

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

Missing Cookbooks:
------------------
Could not satisfy version constraints for: git

Expanded Run List:
------------------
* riak


Running handlers:
[2014-11-15T01:48:55-05:00] ERROR: Running exception handlers
Running handlers complete
[2014-11-15T01:48:55-05:00] ERROR: Exception handlers complete
[2014-11-15T01:48:55-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 3.588961624 seconds
[2014-11-15T01:48:55-05:00] ERROR: 412 "Precondition Failed "
[2014-11-15T01:48:55-05:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
root@test:~/chef/cookbooks/test# 

最后这里是堆栈跟踪,如果它真的对某人有帮助的话:

$ cat /var/chef/cache/chef-stacktrace.out
Generated at 2014-11-15 01:48:55 -0500
Net::HTTPServerException: 412 "Precondition Failed "
/opt/chefdk/embedded/lib/ruby/2.1.0/net/http/response.rb:119:in `error!'
/opt/chefdk/embedded/apps/chef/lib/chef/http.rb:145:in `request'
/opt/chefdk/embedded/apps/chef/lib/chef/http.rb:126:in `post'
/opt/chefdk/embedded/apps/chef/lib/chef/policy_builder/expand_node_object.rb:168:in `sync_cookbooks'
/opt/chefdk/embedded/apps/chef/lib/chef/policy_builder/expand_node_object.rb:66:in `setup_run_context'
/opt/chefdk/embedded/apps/chef/lib/chef/client.rb:265:in `setup_run_context'
/opt/chefdk/embedded/apps/chef/lib/chef/client.rb:429:in `do_run'
/opt/chefdk/embedded/apps/chef/lib/chef/client.rb:213:in `block in run'
/opt/chefdk/embedded/apps/chef/lib/chef/client.rb:207:in `fork'
/opt/chefdk/embedded/apps/chef/lib/chef/client.rb:207:in `run'
/opt/chefdk/embedded/apps/chef/lib/chef/application.rb:236:in `run_chef_client'
/opt/chefdk/embedded/apps/chef/lib/chef/application/client.rb:338:in `block in run_application'
/opt/chefdk/embedded/apps/chef/lib/chef/application/client.rb:327:in `loop'
/opt/chefdk/embedded/apps/chef/lib/chef/application/client.rb:327:in `run_application'
/opt/chefdk/embedded/apps/chef/lib/chef/application.rb:55:in `run'
/opt/chefdk/embedded/apps/chef/bin/chef-client:26:in `<top (required)>'
/usr/bin/chef-client:33:in `load'
/usr/bin/chef-client:33:in `<main>

非常感谢任何帮助。

最佳答案

knife cookbook site install 实际上并没有理解依赖项的版本。它是一个较旧的工具,早于现代 Recipe 如何处理依赖关系。我建议您改为使用 Berkshelf 来管理您的依赖项,它可以正确处理此类事情。

为了更详细地解释这个问题,~> 3.0 约束意味着从 3.0 到 4.0 的任何内容,但不包括 4.0。 knife cookbook site install 刚刚抓取了最新版本的 git cookbook,它是 4.0.2,因此超出了允许的范围。

关于ruby - Chef Recipe 错误 : Error Resolving Cookbooks for Run List,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26943424/

相关文章:

node.js - 使用 chef 在 aws 上安装 node.js 的正确方法

chef-infra - Chef 属性 : does file name matter?

java - 如何将 git 子模块与 Maven 子模块一起使用?

git - Hudson 的 poll scm 支持 git 吗?

git - 如何指定自定义全局 gitconfig 路径?

vagrant - 使用 Chef 显示远程文件进度

ruby - ruby 鞋子的转义字符

ruby-on-rails - 在 rails 中包含模块和类

ruby - sprintf 与 sinatra 不兼容吗?

ruby-on-rails - 提高此服务器代码的性能以查找域?