Include machine name in error message
This will make it easier for folks to debug networking settings.
This commit is contained in:
parent
00b72aa2c5
commit
dfad00fd25
@ -272,7 +272,7 @@ module Vagrant
|
||||
if test_host_ip == "0.0.0.0" || ipv4_interfaces.detect { |iface| iface[1] == test_host_ip }
|
||||
is_port_open?(test_host_ip, host_port)
|
||||
else
|
||||
raise Errors::ForwardPortHostIPNotFound
|
||||
raise Errors::ForwardPortHostIPNotFound, name: @machine.name, host_ip: host_ip
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -2321,10 +2321,13 @@ en:
|
||||
forwarding: Forwarding ports...
|
||||
forwarding_entry: |-
|
||||
%{guest_port} (guest) => %{host_port} (host) (adapter %{adapter})
|
||||
host_ip_not_found:
|
||||
host_ip_not_found: |-
|
||||
You are trying to forward a host IP that does not exist. Please set `host_ip`
|
||||
to the address of an existing IPv4 network interface, or remove the option
|
||||
from your port forward configuration.
|
||||
|
||||
VM: %{name}
|
||||
Host IP: %{host_ip}
|
||||
non_nat: |-
|
||||
VirtualBox adapter #%{adapter} not configured as "NAT". Skipping port
|
||||
forwards on this adapter.
|
||||
|
||||
@ -233,9 +233,11 @@ describe Vagrant::Action::Builtin::HandleForwardedPortCollisions do
|
||||
|
||||
context "when host ip does not exist" do
|
||||
let(:host_ip) { "127.0.0.2" }
|
||||
let(:name) { "default" }
|
||||
|
||||
it "should raise an error" do
|
||||
expect{ instance.send(:port_check, host_ip, host_port) }.to raise_error(Vagrant::Errors::ForwardPortHostIPNotFound)
|
||||
it "should raise an error including the machine name" do
|
||||
allow(machine).to receive(:name).and_return(name)
|
||||
expect{ instance.send(:port_check, host_ip, host_port) }.to raise_error(Vagrant::Errors::ForwardPortHostIPNotFound, /#{name}/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user