Skip to content

Commit

Permalink
fix: Ruby 3 compatibility for network configuration
Browse files Browse the repository at this point in the history
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 #476
  • Loading branch information
PowerKiKi committed Jun 15, 2022
1 parent 22a971b commit dfa331b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions spec/kitchen/driver/vagrant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1241,8 +1241,8 @@ def run_command(_cmd, options = {})
cmd

expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {6}/, "").chomp))
c.vm.network(:forwarded_port, {:guest=>80, :host=>8080})
c.vm.network(:private_network, {:ip=>"192.168.33.33"})
c.vm.network(:forwarded_port, :guest=>80, :host=>8080)
c.vm.network(:private_network, :ip=>"192.168.33.33")
RUBY
end

Expand Down
2 changes: 1 addition & 1 deletion templates/Vagrantfile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Vagrant.configure("2") do |c|
<% end %>

<% Array(config[:network]).each do |opts| %>
c.vm.network(:<%= opts[0] %>, <%= opts[1..-1].join(", ") %>)
c.vm.network(:<%= opts[0] %>, <%= opts[1].to_s.delete_prefix('{').delete_suffix('}') %>)
<% end %>

c.vm.synced_folder ".", "/vagrant", disabled: true
Expand Down

0 comments on commit dfa331b

Please sign in to comment.