2013-10-04 34 views
0

我得到裏面的配方這種方法廚師腳本螞蟻:找不到命令

script "bashbashed" do 
    interpreter "bash" 
    user "root" 

    code <<-EOH 
    cd /my/path 
    ant clean 
    ant build 
    ant deploy 
    EOH 
end 

回報

localhost STDERR: /tmp/chef-script20131004-5434-823zxp: line 1: cd: tarball: No such file or directory 
localhost /tmp/chef-script20131004-5434-823zxp: line 4: ant: command not found 
localhost /tmp/chef-script20131004-5434-823zxp: line 5: ant: command not found 
localhost /tmp/chef-script20131004-5434-823zxp: line 6: ant: command not found 

登錄到客戶,做螞蟻-version。 螞蟻安裝在客人。我仍然在這裏錯過了什麼?

+0

好的..我把螞蟻食譜放在同一個運行列表中,我認爲它可以,只要螞蟻已經安裝在客人中。 「run_list」: \t 「食譜[螞蟻]」, \t 「食譜[myrecipe]」 ], – Ryan

+0

你找到一個解決這個問題呢?回答你自己的問題是可以的。請不要忘記標記答案是正確的! :) – sethvargo

回答

0

該錯誤消息表示2個問題:

  1. 路徑/my/path不存在。
  2. 它不包含路徑到您的java ant安裝在$PATH

的更新版本:

script "bashbashed" do 
    interpreter "bash" 
    user "root" 
    cwd "/my/path" # make sure this path exists 
    path "#{ENV['PATH']}:/opt/ant/bin" # customize to the location of your ant command 

    code <<-EOH 
    ant clean build deploy 
    EOH 
end 
0

你的問題是,在所提供的環境文件「/etc/profile.d/*」不是由root用戶來源,這可以解釋爲什麼你的bash腳本(以root身份運行)沒有在其路徑中配置ant。

也許一個簡單的解決方案將運行構建作爲一個普通的用戶帳戶?