2017-05-25 77 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