From 3726f8d8de38e560293a17b6bd5a06cd597818ad Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 1 Mar 2013 17:07:31 -0800 Subject: [PATCH] Properly use new networks for built-in SSH --- config/default.rb | 4 ++-- plugins/kernel_v2/config/vm.rb | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config/default.rb b/config/default.rb index 7733fcce6..135fc48db 100644 --- a/config/default.rb +++ b/config/default.rb @@ -19,8 +19,8 @@ Vagrant.configure("2") do |config| # Share SSH locally by default config.vm.network :forwarded_port, - host: 22, - guest: 2222, + guest: 22, + host: 2222, id: "ssh", auto_correct: true diff --git a/plugins/kernel_v2/config/vm.rb b/plugins/kernel_v2/config/vm.rb index ed2ae37ee..d34c97fee 100644 --- a/plugins/kernel_v2/config/vm.rb +++ b/plugins/kernel_v2/config/vm.rb @@ -40,7 +40,9 @@ module VagrantPlugins # Custom merge method since some keys here are merged differently. def merge(other) super.tap do |result| - result.instance_variable_set(:@__networks, @__networks.merge(other.networks)) + other_networks = other.instance_variable_get(:@__networks) + + result.instance_variable_set(:@__networks, @__networks.merge(other_networks)) result.instance_variable_set(:@synced_folders, @synced_folders.merge(other.synced_folders)) result.instance_variable_set(:@provisioners, @provisioners + other.provisioners) @@ -107,7 +109,7 @@ module VagrantPlugins end # Merge in the latest settings and set the internal state - @__networks[id] ||= [type, options] + @__networks[id] = [type, options] end # Configures a provider for this VM.