2015-08-27 115 views
-1

我想執行下列通過廚師食譜命令,我需要安裝軟件,在廚師的食譜執行命令

sudo apt-get install autoconf autogen intltool, 
sudo apt-get install build-essential libtool  
sudo apt-get install apache2-threaded-dev 
sudo apt-get install pkg-config  
sudo apt-get install libcurl4-gnutls-dev 

當我嘗試以下方法在我的食譜我得到一個錯誤

execute "Build oauth" do 
command "cd /home/ubuntu/mod_auth_openidc-1.8.0;sudo apt-get install autoconf autogen intltool;sudo apt-get install build-essential libtool" 
end 

誤差

ec2-52-27-144-189.us-west-2.compute.amazonaws.com Ran cd /home/ubuntu/mod_auth_o penidc-1.8.0;sudo apt-get install autoconf autogen intltool;sudo apt-get install build-essential libtool returned 1 ec2-52-27-144-189.us-west-2.compute.amazonaws.com [2015-08-27T11:24:49+00:00] FA TAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfull y (exit code 1)

請指導我這個

+4

並與sudo chef-client一起運行廚師,以便它可以安裝軟件包? – Tensibai

+0

你需要運行'apt-get install --force-yes [package]' – Chris

回答

1

按照@Tensibai的建議。槓桿廚師的package resouce

爲什麼不使用包資源不要使用「執行」難以解釋的錯誤(只返回代碼),而不是idpotent資源(這意味着你不能重複運行你的食譜)

%w[ 
autoconf 
autogen 
intltool 
build-essential 
libtool  
apache2-threaded-dev 
pkg-config  
libcurl4-gnutls-dev 
].each do |dep| 
    package dep do 
    action :install 
    end 
end 
+0

可能值得關於%w的一句話[這裏是快捷方式列表](http://caiustheory.com/ruby-shortcuts/) – Tensibai