2012-03-29 5 views
4

私はphpunitをインストールするためのレグメントを作成しましたが、シェフのレシピが既に完了してから実行を停止する方法

execute "discover phpunit" do 
    command "pear channel-discover pear.phpunit.de" 
    action :run 
end 

execute "config phpunit" do 
    command "pear config-set auto_discover 1" 
    action :run 
end 

execute "install phpunit" do 
    command "pear install pear.phpunit.de/PHPUnit" 
    action :run 
end 

は私が取得:何が起こっているかのように見えます

[default] [Thu, 29 Mar 2012 14:39:57 -0700] ERROR: execute[discover phpunit] (phpunit::default line 39) has had an error 
[Thu, 29 Mar 2012 14:39:57 -0700] ERROR: execute[discover phpunit] (/tmp/vagrant-chef-1/chef-solo-1/phpunit/recipes/default.rb:39:in `from_file') had an error: 
execute[discover phpunit] (phpunit::default line 39) had an error: Chef::Exceptions::ShellCommandFailed: Expected process to exit with [0], but received '1' 
---- Begin output of pear channel-discover pear.phpunit.de ---- 
STDOUT: Channel "pear.phpunit.de" is already initialized 
+0

あなたはどのバージョンのお粥をお使いですか? –

+0

@MichaelIrey version 0.8.7 – NathanBrakk

答えて

4

は、このスクリプトはvagrant upが実行されるたびに実行されています。ただ、むしろそれに頼るよりも、phpunitはあなたが$PATH

+0

これは本当です。いいです!別の質問があります:もしそれがphpunitを持っていれば、レシピを終了させるにはどうしたらいいですか? – NathanBrakk

+0

@ NathanBrakk基本的に手続き型のスクリプトなので、レシピを「終了」する方法はまったくありません。 – Andrew

+1

他の言葉で言えば、あなたの料理本を冪等にするのはあなた次第です。 – manojlds

0

私はおそらく

not_if { File.exists?('/path/to/phpunit') 

にnot_ifを設定したいであることを確認してください

execute "discover phpunit" do 
    command "pear channel-discover pear.phpunit.de" 
    action :run 
    not_if "which phpunit" 
end 

は、おそらくこのような何かをしたいです$ PATHに見つかりました。

関連する問題