Merge pull request #4671 from jramnani/fix/master/nfs_exports_file_for_freebsd_guests
Fix #4658. Bad NFS exports file on OS X & BSD hosts.
This commit is contained in:
commit
7287604450
|
@ -269,7 +269,12 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_guest_ip(adapter_number)
|
def read_guest_ip(adapter_number)
|
||||||
read_guest_property("/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP")
|
ip = read_guest_property("/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP")
|
||||||
|
if !valid_ip_address?(ip)
|
||||||
|
raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, guest_property: "/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP"
|
||||||
|
end
|
||||||
|
|
||||||
|
return ip
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_guest_property(property)
|
def read_guest_property(property)
|
||||||
|
@ -500,6 +505,16 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def valid_ip_address?(ip)
|
||||||
|
# Filter out invalid IP addresses
|
||||||
|
# GH-4658 VirtualBox can report an IP address of 0.0.0.0 for FreeBSD guests.
|
||||||
|
if ip == "0.0.0.0"
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def verify!
|
def verify!
|
||||||
# This command sometimes fails if kernel drivers aren't properly loaded
|
# This command sometimes fails if kernel drivers aren't properly loaded
|
||||||
# so we just run the command and verify that it succeeded.
|
# so we just run the command and verify that it succeeded.
|
||||||
|
|
|
@ -274,7 +274,12 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_guest_ip(adapter_number)
|
def read_guest_ip(adapter_number)
|
||||||
read_guest_property("/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP")
|
ip = read_guest_property("/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP")
|
||||||
|
if !valid_ip_address?(ip)
|
||||||
|
raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, guest_property: "/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP"
|
||||||
|
end
|
||||||
|
|
||||||
|
return ip
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_guest_property(property)
|
def read_guest_property(property)
|
||||||
|
@ -510,6 +515,16 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def valid_ip_address?(ip)
|
||||||
|
# Filter out invalid IP addresses
|
||||||
|
# GH-4658 VirtualBox can report an IP address of 0.0.0.0 for FreeBSD guests.
|
||||||
|
if ip == "0.0.0.0"
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def verify!
|
def verify!
|
||||||
# This command sometimes fails if kernel drivers aren't properly loaded
|
# This command sometimes fails if kernel drivers aren't properly loaded
|
||||||
# so we just run the command and verify that it succeeded.
|
# so we just run the command and verify that it succeeded.
|
||||||
|
|
|
@ -305,7 +305,12 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_guest_ip(adapter_number)
|
def read_guest_ip(adapter_number)
|
||||||
read_guest_property("/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP")
|
ip = read_guest_property("/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP")
|
||||||
|
if !valid_ip_address?(ip)
|
||||||
|
raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, guest_property: "/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP"
|
||||||
|
end
|
||||||
|
|
||||||
|
return ip
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_guest_property(property)
|
def read_guest_property(property)
|
||||||
|
@ -541,6 +546,16 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def valid_ip_address?(ip)
|
||||||
|
# Filter out invalid IP addresses
|
||||||
|
# GH-4658 VirtualBox can report an IP address of 0.0.0.0 for FreeBSD guests.
|
||||||
|
if ip == "0.0.0.0"
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def verify!
|
def verify!
|
||||||
# This command sometimes fails if kernel drivers aren't properly loaded
|
# This command sometimes fails if kernel drivers aren't properly loaded
|
||||||
# so we just run the command and verify that it succeeded.
|
# so we just run the command and verify that it succeeded.
|
||||||
|
|
|
@ -314,7 +314,12 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_guest_ip(adapter_number)
|
def read_guest_ip(adapter_number)
|
||||||
read_guest_property("/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP")
|
ip = read_guest_property("/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP")
|
||||||
|
if !valid_ip_address?(ip)
|
||||||
|
raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, guest_property: "/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP"
|
||||||
|
end
|
||||||
|
|
||||||
|
return ip
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_guest_property(property)
|
def read_guest_property(property)
|
||||||
|
@ -557,6 +562,16 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def valid_ip_address?(ip)
|
||||||
|
# Filter out invalid IP addresses
|
||||||
|
# GH-4658 VirtualBox can report an IP address of 0.0.0.0 for FreeBSD guests.
|
||||||
|
if ip == "0.0.0.0"
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def verify!
|
def verify!
|
||||||
# This command sometimes fails if kernel drivers aren't properly loaded
|
# This command sometimes fails if kernel drivers aren't properly loaded
|
||||||
# so we just run the command and verify that it succeeded.
|
# so we just run the command and verify that it succeeded.
|
||||||
|
|
|
@ -38,5 +38,16 @@ shared_examples "a version 4.x virtualbox driver" do |options|
|
||||||
|
|
||||||
expect(value).to eq("127.1.2.3")
|
expect(value).to eq("127.1.2.3")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "does not accept 0.0.0.0 as a valid IP address" do
|
||||||
|
key = "/VirtualBox/GuestInfo/Net/1/V4/IP"
|
||||||
|
|
||||||
|
expect(subprocess).to receive(:execute).
|
||||||
|
with("VBoxManage", "guestproperty", "get", uuid, key, an_instance_of(Hash)).
|
||||||
|
and_return(subprocess_result(stdout: "Value: 0.0.0.0"))
|
||||||
|
|
||||||
|
expect { subject.read_guest_ip(1) }.
|
||||||
|
to raise_error Vagrant::Errors::VirtualBoxGuestPropertyNotFound
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue