2017-05-25 112 views
0

我正在使用厨师安装和配置非常基本的Jenkins安装。当我尝试运行以下配方:厨师 - 食谱包未能找到候选版本

include_recipe "apt::default" 

apt_repository "jenkins" do 
    uri "http://pkg.jenkins-ci.org/debian" 
    key "http://pkg.jenkins-ci.org/debian/jenkins-ci.org" 
    components ["binary/"] 
    action :add 
end 

package "jenkins" do 
    version '2.62' 
end 


service "jenkins" do 
    supports [:stop, :start, :restart] 
    action [:start, :enable] 
end 

我收到以下错误(在终端上显示):

192.168.9.207 [2017-05-25T10:50:58-04:00] ERROR: Running exception handlers 
192.168.9.207 Running handlers complete 
192.168.9.207 [2017-05-25T10:50:58-04:00] ERROR: Exception handlers complete 
192.168.9.207 Chef Client failed. 2 resources updated in 20 seconds 
192.168.9.207 [2017-05-25T10:50:58-04:00] INFO: Sending resource update report (run-id: 2b59b80e-b787-4e93-805b-837b4d3264fb) 
192.168.9.207 [2017-05-25T10:50:58-04:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out 
192.168.9.207 [2017-05-25T10:50:58-04:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report 
192.168.9.207 [2017-05-25T10:50:58-04:00] ERROR: apt_package[jenkins] (jenkins-installation::default line 21) had an error: Chef::Exceptions::Package: No candidate version available for jenkins 
192.168.9.207 [2017-05-25T10:50:58-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1) 

的错误解释,有没有可用的候选版本詹金斯。运行失败后,如果我执行sudo收到以下错误管理节点上的apt-get update更新:

Err http://pkg.jenkins-ci.org trusty/binary/ amd64 Packages      
    404 Not Found 
Err http://pkg.jenkins-ci.org trusty/binary/ i386 Packages   
    404 Not Found 
Ign http://pkg.jenkins-ci.org trusty/binary/ Translation-en_US  
Ign http://pkg.jenkins-ci.org trusty/binary/ Translation-en 
Fetched 5,976 kB in 3s (1,528 kB/s)    
W: Failed to fetch http://pkg.jenkins-ci.org/debian/dists/trusty/binary//binary-amd64/Packages 404 Not Found 

W: Failed to fetch http://pkg.jenkins-ci.org/debian/dists/trusty/binary//binary-i386/Packages 404 Not Found 

E: Some index files failed to download. They have been ignored, or old ones used instead. 

我是相当新的厨师。此错误似乎与检索Jenkins软件包有关,但我不确定如何解决此错误。请让我知道是否需要额外的信息来解决这个问题。

非常感谢大家提前提供任何指导。我已经通过厨师文档进行了搜索,但除了指定软件包版本外,没有看到太多内容:https://docs.chef.io/resource_package.html

+0

为'package'资源将者均基于'version'说法。不适用于apt。你必须使用明确的固定钉(这是一个PITA)。 – StephenKing

回答

0

指定distribution 'binary/'而不是components 'binary/'。这将修复你得到的404,因为trusty/binary/

至少,这是我从"official" Jenkins cookbook,我btw看到的。建议使用。

编辑:那么,结果将是:

apt_repository "jenkins" do 
    uri "http://pkg.jenkins-ci.org/debian" 
    key "http://pkg.jenkins-ci.org/debian/jenkins-ci.org" 
    distribution "binary/" 
end 
+0

太棒了!感谢您指点我正确的方向。我确实修改了组件以便分发,但是当启动包含运行列表中的配方的chef-client运行时,我收到以下错误:[2017-05-25T11:59:42-04:00]错误:属性分配必须是其中之一:字符串,零,假!你传递了[“binary /”]。在这种情况下,我是否应该传递一个属性而不是二进制文件? – J0991

+0

不,你通过了一个列表,而不是一个字符串。将编辑我的问题。 – StephenKing

+0

太棒了!非常感谢你指点我正确的方向@StephenKing – J0991