guests/darwin: Allow ipv6 static networks

This commit is contained in:
Seth Vargo 2016-06-19 11:48:11 -04:00
parent 22c24d619c
commit 177b7784dd
No known key found for this signature in database
GPG Key ID: 905A90C2949E8787
3 changed files with 18 additions and 5 deletions

View File

@ -448,6 +448,10 @@ module Vagrant
error_key(:not_found, "vagrant.actions.vm.host_only_network")
end
class NetworkTypeNotSupported < VagrantError
error_key(:network_type_not_supported)
end
class NFSBadExports < VagrantError
error_key(:nfs_bad_exports)
end

View File

@ -35,12 +35,19 @@ module VagrantPlugins
end
network_type = network[:type].to_sym
if network_type == :static
command = "networksetup -setmanual \"#{service_name}\" #{network[:ip]} #{network[:netmask]}"
elsif network_type == :dhcp
case network_type.to_sym
when :static
command = "networksetup -setmanual \"#{service_name}\" #{network[:ip]} #{network[:netmask]} #{network[:router]}"
when :static6
command = "networksetup -setv6manual \"#{service_name}\" #{network[:ip]} #{network[:netmask]} #{network[:router]}"
when :dhcp
command = "networksetup -setdhcp \"#{service_name}\""
when :dhcp6
# This is not actually possible yet in Vagrant, but when we do
# enable IPv6 across the board, Darwin will already have support.
command = "networksetup -setv6automatic \"#{service_name}\""
else
raise "#{network_type} network type is not supported, try static or dhcp"
raise Vagrant::Errors::NetworkTypeNotSupported, type: network_type
end
machine.communicate.sudo(command)

View File

@ -869,6 +869,8 @@ en:
If the problem persists, please report a bug to the net-ssh project.
%{message}
network_type_not_supported: |-
The %{type} network type is not supported for this box or guest.
nfs_bad_exports: |-
NFS is reporting that your exports file is invalid. Vagrant does
this check before making any changes to the file. Please correct