Vagrant ubuntu / trusty64包含旧版本的Ruby,导致测试厨房失败

时间:2018-01-01 15:15:51

标签: vagrant test-kitchen

我试图用Vagrant(Ubuntu / trusty64)学习Ansible,我试图用test-kitchen来断言我的设置。

我遇到的问题是Vagrant机器有旧版本的Ruby(1.9.1),因此其中一个依赖项(busser)无法运行。我收到的错误是:

-----> Installing Busser (busser)
Fetching: thor-0.19.0.gem (100%)
Fetching: busser-0.7.1.gem (100%)
       Successfully installed thor-0.19.0
       Successfully installed busser-0.7.1
       2 gems installed

-----> Installing Busser plugin: busser-serverspec
   /usr/lib/ruby/1.9.1/rubygems/installer.rb:390:in 
'ensure_required_ruby_version_met': rake requires Ruby version >= 2.0.0. 
(Gem::InstallError)

当我运行命令'捆绑exec厨房测试' vagrant正在从中下载basebox https://vagrantcloud.com/ubuntu/boxes/trusty64/versions/20171208.0.0/providers/virtualbox.box

这是我的Gemfile,后跟我的kitchenfile.yml文件。

source 'https://rubygems.org'
gem 'test-kitchen', '~> 1.19.2'
gem 'kitchen-ansible', '~> 0.48.1'
gem 'kitchen-vagrant', '~> 1.2.1'
gem 'serverspec', '~> 2.41.3'
driver:
  name: vagrant

provisioner:
  name: ansible_playbook
  playbook: playbook.yml
  hosts: all
  require_chef_for_busser: false
  require_ruby_for_busser: true

platforms:
  - name: ubuntu
    driver_config:
      box: "ubuntu/trusty64"

suites:
  - name: default

verifier:
  ruby_bindir: '/usr/bin'

1 个答案:

答案 0 :(得分:0)

感谢上面的休伯特,我改变了

platforms:
  - name: ubuntu
    driver_config:
      box: "ubuntu/trusty64"

platforms:
  - name: ubuntu/xenial64