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

ゲストにログインして ant -version を実行します。ant がゲストにインストールされます。ここでまだ何かが足りないのですか?

4

2 に答える 2

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
于 2013-10-04T13:20:28.847 に答える
0

あなたの問題は、「/etc/profile.d/*」の下で提供される環境ファイルが root ユーザーによって提供されていないことです。これは、(root として実行されている) bash スクリプトのパスに ant が構成されていない理由を説明します。

おそらく簡単な解決策は、通常のユーザー アカウントとしてビルドを実行することでしょうか?

于 2013-10-05T10:24:38.177 に答える