test-kitchen / kitchen-vagrant

A Test Kitchen Driver for Vagrant
Other
348 stars 189 forks source link

Unable to configure network with Vagrant/VirtualBox #476

Closed neclimdul closed 1 year ago

neclimdul commented 2 years ago

:ghost: Brief Description

This is a continuation of the problems from #459 I guess. With Ubuntu 22.04 vagrant gets install with Ruby 3 and I can't figure out a way to get the fixes in the related threads to work. The fix of "use ruby2.7" isn't really available best I can tell at least not without some sort of rbenv hacks.

Version

$ bundle exec kitchen --version Test Kitchen version 3.2.2 $ vagrant --version Vagrant 2.2.19

Environment

Ubuntu 22.04

Scenario

Get test kitchen to run with a configured network.

Steps to Reproduce

Start with ubuntu 22.04. Install vagrant and bundler.

.kitchen.yml

---
driver:
  name: vagrant
platforms:
  - name: ubuntu-22.04

suites:
  - name: default
    driver:
      network:
      - ["private_network", {ip: "10.33.30.6"}]

Gemfile

source 'https://rubygems.org'

gem 'kitchen-vagrant'
gem 'test-kitchen'
bundle install
bundle exec kitchen verify

Expected Result

Test kitchen runs without errors.

Actual Result

-----> Starting Test Kitchen (v3.2.2)
-----> Creating <default-ubuntu-2204>...
       /usr/share/rubygems-integration/all/gems/vagrant-2.2.19/plugins/kernel_v2/config/vm.rb:319:in `network': wrong number of arguments (given 2, expected 1) (ArgumentError)
        from /home/.../tmp/.kitchen/kitchen-vagrant/default-ubuntu-2204/Vagrantfile:5:in `block in <top (required)>'
        from /usr/share/rubygems-integration/all/gems/vagrant-2.2.19/lib/vagrant/config/v2/loader.rb:37:in `load'
        from /usr/share/rubygems-integration/all/gems/vagrant-2.2.19/lib/vagrant/config/loader.rb:126:in `block (2 levels) in load'
        from /usr/share/rubygems-integration/all/gems/vagrant-2.2.19/lib/vagrant/config/loader.rb:119:in `each'
        from /usr/share/rubygems-integration/all/gems/vagrant-2.2.19/lib/vagrant/config/loader.rb:119:in `block in load'
        from /usr/share/rubygems-integration/all/gems/vagrant-2.2.19/lib/vagrant/config/loader.rb:116:in `each'
        from /usr/share/rubygems-integration/all/gems/vagrant-2.2.19/lib/vagrant/config/loader.rb:116:in `load'
        from /usr/share/rubygems-integration/all/gems/vagrant-2.2.19/lib/vagrant/vagrantfile.rb:29:in `initialize'
        from /usr/share/rubygems-integration/all/gems/vagrant-2.2.19/lib/vagrant/environment.rb:793:in `new'
        from /usr/share/rubygems-integration/all/gems/vagrant-2.2.19/lib/vagrant/environment.rb:793:in `vagrantfile'
        from /usr/share/rubygems-integration/all/gems/vagrant-2.2.19/lib/vagrant/environment.rb:974:in `process_configured_plugins'
        from /usr/share/rubygems-integration/all/gems/vagrant-2.2.19/lib/vagrant/environment.rb:178:in `initialize'
        from /usr/share/rubygems-integration/all/gems/vagrant-2.2.19/bin/vagrant:194:in `new'
        from /usr/share/rubygems-integration/all/gems/vagrant-2.2.19/bin/vagrant:194:in `<top (required)>'
        from /usr/bin/vagrant:25:in `load'
        from /usr/bin/vagrant:25:in `<main>'
>>
...

:heavy_plus_sign: Additional context

I understand this is kinda a mess and there might not be a lot this project can do since this is a problem with vagrant but hoping there's something that can be done to support writing Vargant files that can run in Ruby 3.

openfirmware commented 2 years ago

I ran into this issue as well; same errors. I downgraded from Vagrant 2.2.19 to 2.2.18 and the Vagrantfile generated by Test Kitchen (this driver) are properly read by Vagrant and the VM is created.

vkarve-chef commented 1 year ago

this is to be marked as closed when we release an updated gem that has the fix, only PR is merged to main as of now

PowerKiKi commented 1 year ago

The recently released 1.12.1 contains the fix for this issue.

@vkarve-chef or @neclimdul, please close this issue.