Play2厨师食谱不在Vagrant机器上安装

时间:2014-01-14 06:32:46

标签: ruby chef vagrant rubyzip

我尝试将this Play2 cookbook添加到与Vagrant一​​起运行的cookbook列表中,并在执行vagrant provision时收到错误

FATAL: Gem::InstallError: chef_gem[rubyzip] (play2::default line 20) had an error: Gem::InstallError: rubyzip requires Ruby version >= 1.9.2.

所以我使用了另一个安装了Ruby 1.9.3的基盒:

# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64-ruby1.9.3"

# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "https://dl.dropbox.com/u/14292474/vagrantboxes/precise64-ruby-1.9.3-p194.box"

然而,使用Vagrant进行配置仍然会产生相同的错误。而确实是使用Ruby 1.9.3:

$ vagrant ssh
Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-23-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

Welcome to your Vagrant-built virtual machine.
Last login: Sun Aug 19 22:42:58 2012 from 10.0.2.2
vagrant@precise64:~$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

在SSH进入Vagrant机器后,gem install rubyzip正常工作。为什么vagrant provision在这里不起作用?

1 个答案:

答案 0 :(得分:2)

如果要将其安装在系统的ruby中,请将其安装为gem_package。 Chef带来了它自己的ruby(omnibus安装程序的概念),而chef_gem是用于在该环境中安装gem的LWRP。