2012-03-29 3 views
4

나는 방울뱀을 설치하는 방랑자를위한 요리법을 만들었지 만, 방황하는 것을 멈추고 계속해서 막연한 먹이를 먹으면 실패합니다.요리사 레시피가 이미 완료되었을 때 실행을 멈추는 방법

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에서 찾을 수 있습니다.

관련 문제