prepare_nfs_settings: Try harder to get all machine IPs.
Vagrant was not behaving correctly in configurations where there was a static IP on a VirtualBox `intnet` interface and a DHCP `:hostonly` interface configured. Since `machine_ip` attempted to get static addresses `||` dynamic addresses, it would simply use the static machine address and continue. This commit corrects this behaviour by collecting all static and dynamic addresses into the `machine_ip` array instead of just one or the other. The result of this is a correctly generated `/etc/exports` on the host machine, allowing NFS mounts to work correctly in this type of environment.
This commit is contained in:
parent
788bd557c4
commit
ed708645b2
|
@ -36,8 +36,19 @@ module VagrantPlugins
|
||||||
#
|
#
|
||||||
# The ! indicates that this method modifies its argument.
|
# The ! indicates that this method modifies its argument.
|
||||||
def add_ips_to_env!(env)
|
def add_ips_to_env!(env)
|
||||||
adapter, host_ip = find_host_only_adapter
|
adapter, host_ip = find_host_only_adapter
|
||||||
machine_ip = read_static_machine_ips || read_dynamic_machine_ip(adapter)
|
machine_ip = read_static_machine_ips
|
||||||
|
dynamic_machine_ip = read_dynamic_machine_ip(adapter)
|
||||||
|
|
||||||
|
if machine_ip.nil?
|
||||||
|
# If there were no static IPs, attempt to use the dynamic IP
|
||||||
|
# instead.
|
||||||
|
machine_ip = dynamic_machine_ip
|
||||||
|
else
|
||||||
|
# If we did get some static machine IPs, add the dynamic IPs to
|
||||||
|
# that list too.
|
||||||
|
machine_ip.push(dynamic_machine_ip) unless dynamic_machine_ip.nil?
|
||||||
|
end
|
||||||
|
|
||||||
raise Vagrant::Errors::NFSNoHostonlyNetwork if !host_ip || !machine_ip
|
raise Vagrant::Errors::NFSNoHostonlyNetwork if !host_ip || !machine_ip
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue