厨师食谱安装铬centos7

时间:2016-06-28 19:10:28

标签: google-chrome chef centos7 cookbook

我正在尝试使用chefdk和本地模式在我的centos 7桌面上安装chrome。 chrome直接使用yum安装,我使用它作为厨师的学习练习。到目前为止,对于centos 7.2和macosx 10.11.5上的apt的依赖性检查失败了。 centos的详细信息仅显示在下方。基本食谱,例如yum和apt安装正常,所以我在这里遗漏了一些东西。 谢谢你的帮助。

CentOS Linux release 7.2.1511 (Core)
Installed: yum-3.4.3-132.el7.centos.0.1.noarch 
using 
chefdk.x86_64                              0.15.15-1.el7               @/chefdk-0.15.15-1.el7.x86_64

knife cookbook show chrome
chrome   1.2.2

当我尝试安装时:

sudo sudo chef-client --local-mode  --runlist 'recipe[chrome]' 2>&1 | tee  /export/cookbooks/install_chrome_from_cookbook.2.log

它尝试使用apt并因为apt版本失败而失败:请参阅下面的日志。

问题是什么?

cat /export/cookbooks/install_chrome_from_cookbook.2.log

`    [2016-06-28T00:35:35-04:00] WARN: No config file found or specified on command line, using command line options.
>   [2016-06-28T00:35:35-04:00] INFO: Auto-discovered chef repository at /export
>   [2016-06-28T00:35:36-04:00] INFO: Started chef-zero at     chefzero://localhost:8889 with repository at /export
>     One version per cookbook

>    [2016-06-28T00:35:36-04:00] INFO: Forking chef instance to converge...
>    [2016-06-28T00:35:36-04:00] INFO: *** Chef 12.11.18 ***
>    [2016-06-28T00:35:36-04:00] INFO: Platform: x86_64-linux
>    [2016-06-28T00:35:36-04:00] INFO: Chef-client pid: 7293
>    [2016-06-28T00:35:38-04:00] INFO: GET /organizations/chef/nodes/nuctv-w.lfz.net
>    [2016-06-28T00:35:38-04:00] INFO: Setting the run_list to [#<Chef::RunList::RunListItem:0x00000004e13468 @version=nil, @type=:recipe, @name="chrome">] from CLI options
>    [2016-06-28T00:35:38-04:00] INFO: Run List is [recipe[chrome]]
>    [2016-06-28T00:35:38-04:00] INFO: Run List expands to [chrome]
>    [2016-06-28T00:35:38-04:00] INFO: Starting Chef Run for nuctv-w.lfz.net
>    [2016-06-28T00:35:38-04:00] INFO: Running start handlers
>    [2016-06-28T00:35:38-04:00] INFO: Start handlers complete.
>    [2016-06-28T00:35:38-04:00] INFO: POST /organizations/chef/reports/nodes/nuctv-w.lfz.net/runs
>    --- POST BODY ---
>    {"action":"start","run_id":"8532d8c8-2e83-45e3-b867-f55f264a93df","start_time":"2016-06-28 00:35:38 -0400"}
>    --- END POST BODY ---
>    [2016-06-28T00:35:38-04:00] INFO: HTTP Request Returned 404 Not Found: Object not found: 
>    [2016-06-28T00:35:38-04:00] INFO: POST /organizations/chef/environments/_default/cookbook_versions
>    --- POST BODY ---
>    {"run_list":["chrome"]}
>    --- END POST BODY ---
>    [2016-06-28T00:35:39-04:00] INFO: #<ChefZero::RestErrorResponse: 412: Could not satisfy version constraints for: apt>
>    /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb:42:in `post'
>    ....
>    /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/bin/chef-client:26:in `<top (required)>'
>    /bin/chef-client:52:in `load'
>    /bin/chef-client:52:in `<main>'
>    [2016-06-28T00:35:39-04:00] INFO: HTTP Request Returned 412 Precondition Failed: Could not satisfy version constraints for: apt

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

>    Missing Cookbooks:
------------------
Could not satisfy version constraints for: apt

Expanded Run List:
------------------
* chrome

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

[2016-06-28T00:35:39-04:00] ERROR: Running exception handlers
[2016-06-28T00:35:39-04:00] ERROR: Exception handlers complete
[2016-06-28T00:35:39-04:00] FATAL: Stacktrace dumped to /root/.chef/local-mode-cache/cache/chef-stacktrace.out
[2016-06-28T00:35:39-04:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-06-28T00:35:39-04:00] ERROR: 412 "Precondition Failed"
[2016-06-28T00:35:40-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)`

1 个答案:

答案 0 :(得分:1)

总是需要Chef依赖项,即使它们不被使用也是如此。如果您使用更现代的烹饪书上传工具,如Berkshelf或chef push,它将为您解决此问题。