Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to configure network with Vagrant/VirtualBox #476

Closed
neclimdul opened this issue Jun 9, 2022 · 3 comments · May be fixed by Ecodev/kitchen-vagrant#1
Closed

Unable to configure network with Vagrant/VirtualBox #476

neclimdul opened this issue Jun 9, 2022 · 3 comments · May be fixed by Ecodev/kitchen-vagrant#1
Labels

Comments

@neclimdul
Copy link

👻 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

  • kitchen-vagrant (1.11.0)

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>'
>>
...

➕ 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.

PowerKiKi added a commit to Ecodev/kitchen-vagrant that referenced this issue Jun 15, 2022
The final Vagrant file should be compatible with Ruby 2.7 and 3,
so it should look like that:

```diff
- c.vm.network(:forwarded_port, {:guest=>443, :host=>2443})
+ c.vm.network(:forwarded_port, :guest=>443, :host=>2443)
```

Fixes test-kitchen#476
PowerKiKi added a commit to Ecodev/kitchen-vagrant that referenced this issue Jun 15, 2022
The final Vagrant file should be compatible with Ruby 2.7 and 3,
so it should look like that:

```diff
- c.vm.network(:forwarded_port, {:guest=>443, :host=>2443})
+ c.vm.network(:forwarded_port, :guest=>443, :host=>2443)
```

Fixes test-kitchen#476
PowerKiKi added a commit to Ecodev/kitchen-vagrant that referenced this issue Jun 15, 2022
The final Vagrant file should be compatible with Ruby 2.7 and 3,
so it should look like that:

```diff
- c.vm.network(:forwarded_port, {:guest=>443, :host=>2443})
+ c.vm.network(:forwarded_port, :guest=>443, :host=>2443)
```

Fixes test-kitchen#476
@openfirmware
Copy link

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
Copy link
Contributor

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
Copy link
Contributor

The recently released 1.12.1 contains the fix for this issue.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants