From 4db3d491577339c6df1e2c90256c1693c1d91abe Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Thu, 12 Apr 2018 14:16:13 -0700 Subject: [PATCH] Improve network collision error message This commit provides a bit more information when a non-hostonly network collides with a host network. --- plugins/providers/virtualbox/action/network.rb | 8 ++++++-- templates/locales/en.yml | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/providers/virtualbox/action/network.rb b/plugins/providers/virtualbox/action/network.rb index 58117a0fc..cb8f6da7a 100644 --- a/plugins/providers/virtualbox/action/network.rb +++ b/plugins/providers/virtualbox/action/network.rb @@ -280,8 +280,12 @@ module VagrantPlugins # interface. @env[:machine].provider.driver.read_bridged_interfaces.each do |interface| that_netaddr = network_address(interface[:ip], interface[:netmask]) - raise Vagrant::Errors::NetworkCollision if \ - netaddr == that_netaddr && interface[:status] != "Down" + if netaddr == that_netaddr && interface[:status] != "Down" + raise Vagrant::Errors::NetworkCollision, + netaddr: netaddr, + that_netaddr: that_netaddr, + interface_name: interface[:name] + end end # Split the IP address into its components diff --git a/templates/locales/en.yml b/templates/locales/en.yml index f349dad21..c0897632b 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -2076,6 +2076,9 @@ en: This will cause your specified IP to be inaccessible. Please change the IP or name of your host only network so that it no longer matches that of a bridged or non-hostonly network. + + Bridged Network Address: '%{netaddr}' + Host-only Network '%{interface_name}': '%{that_netaddr}' creating: "Creating new host only network for environment..." enabling: "Enabling host only network..." not_found: |-