1

我想使用 Vagrant 作为我正在从事的几个项目的生产机器。如果我可以使用 Chef Solo 配置 Vagrant 来检查我的代码的最新版本,那将是理想的。这将大大改善测试。

目前我有一个使用以下的食谱:

git "Checkout Code" do
    repository "git://github.com/opscode-cookbooks/git.git"
    reference "master" # or "HEAD" or "TAG_for_1.0" or (subversion) "1234"
    action :checkout
    destination "/home/vagrant/git"
end

作为概念证明,我正在使用公共存储库。

我收到以下错误消息:

[default] Running provisioner: Vagrant::Provisioners::ChefSolo...
[default] Generating chef JSON and uploading...
[default] Running chef-solo...
stdin: is not a tty
[Sun, 17 Jun 2012 04:08:49 +0200] INFO: *** Chef 0.10.10 ***
[Sun, 17 Jun 2012 04:08:49 +0200] INFO: Setting the run_list to ["recipe[test_app::deploy]"] from JSON
[Sun, 17 Jun 2012 04:08:49 +0200] INFO: Run List is [recipe[test_app::deploy]]
[Sun, 17 Jun 2012 04:08:49 +0200] INFO: Run List expands to [test_app::deploy]
[Sun, 17 Jun 2012 04:08:49 +0200] INFO: Starting Chef Run for lucid32
[Sun, 17 Jun 2012 04:08:49 +0200] INFO: Running start handlers
[Sun, 17 Jun 2012 04:08:49 +0200] INFO: Start handlers complete.
[Sun, 17 Jun 2012 04:08:49 +0200] INFO: Processing git[Checkout Code] action checkout (test_app::deploy line 23)
[Sun, 17 Jun 2012 04:08:49 +0200] INFO: git[Checkout Code] cloning repo git://github.com/opscode-cookbooks/git.git to /home/vagrant/git
[Sun, 17 Jun 2012 04:08:49 +0200] ERROR: git[Checkout Code] (test_app::deploy line 23) has had an error
[Sun, 17 Jun 2012 04:08:49 +0200] ERROR: git[Checkout Code] (/tmp/vagrant-chef-1/chef-solo-1/cookbooks/test_app/recipes/deploy.rb:23:in `from_file') had an error:
git[Checkout Code] (test_app::deploy line 23) had an error: Errno::ENOENT: No such file or directory - git clone  git://github.com/opscode-cookbooks/git.git /home/vagrant/git
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/mixlib-shellout-1.0.0.rc.1/lib/mixlib/shellout/unix.rb:213:in `exec'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/mixlib-shellout-1.0.0.rc.1/lib/mixlib/shellout/unix.rb:213:in `fork_subprocess'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/mixlib-shellout-1.0.0.rc.1/lib/mixlib/shellout/unix.rb:203:in `fork'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/mixlib-shellout-1.0.0.rc.1/lib/mixlib/shellout/unix.rb:203:in `fork_subprocess'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/mixlib-shellout-1.0.0.rc.1/lib/mixlib/shellout/unix.rb:35:in `run_command'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/mixlib-shellout-1.0.0.rc.1/lib/mixlib/shellout.rb:216:in `run_command'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/shell_out.rb:30:in `shell_out'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/shell_out.rb:35:in `shell_out!'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/provider/git.rb:125:in `clone'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/provider/git.rb:43:in `action_checkout'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource.rb:454:in `send'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource.rb:454:in `run_action'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/runner.rb:49:in `run_action'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/runner.rb:85:in `converge'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/runner.rb:85:in `each'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/runner.rb:85:in `converge'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource_collection.rb:94:in `execute_each_resource'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource_collection.rb:92:in `execute_each_resource'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/runner.rb:80:in `converge'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/client.rb:330:in `converge'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/client.rb:163:in `run'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/solo.rb:207:in `run_application'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/solo.rb:195:in `loop'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/solo.rb:195:in `run_application'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application.rb:70:in `run'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-0.10.10/bin/chef-solo:25
/opt/vagrant_ruby/bin/chef-solo:19:in `load'
/opt/vagrant_ruby/bin/chef-solo:19
[Sun, 17 Jun 2012 04:08:49 +0200] ERROR: Running exception handlers
[Sun, 17 Jun 2012 04:08:49 +0200] ERROR: Exception handlers complete
[Sun, 17 Jun 2012 04:08:49 +0200] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[Sun, 17 Jun 2012 04:08:49 +0200] FATAL: Errno::ENOENT: git[Checkout Code] (test_app::deploy line 23) had an error: Errno::ENOENT: No such file or directory - git clone  git://github.com/opscode-cookbooks/git.git /home/vagrant/git
4

1 回答 1

6

我是一个傻瓜。我没有先将“git”配方添加到我的 Vagrantfile 中。结果?尝试在系统上安装 git 之前使用它。

于 2012-06-17T02:24:05.777 回答