providers/virtualbox: more support
This commit is contained in:
parent
199a58fdd9
commit
05fbb4ced2
|
@ -48,10 +48,19 @@ module VagrantPlugins
|
|||
interface = execute("hostonlyif", "create")
|
||||
name = interface[/^Interface '(.+?)' was successfully created$/, 1]
|
||||
|
||||
# Configure it
|
||||
execute("hostonlyif", "ipconfig", name,
|
||||
"--ip", options[:adapter_ip],
|
||||
"--netmask", options[:netmask])
|
||||
# Get the IP so we can determine v4 vs v6
|
||||
ip = IPAddr.new(options[:adapter_ip])
|
||||
|
||||
# Configure
|
||||
if ip.ipv4?
|
||||
execute("hostonlyif", "ipconfig", name,
|
||||
"--ip", options[:adapter_ip],
|
||||
"--netmask", options[:netmask])
|
||||
elsif ip.ipv6?
|
||||
execute("hostonlyif", "ipconfig", name,
|
||||
"--ipv6", options[:adapter_ip],
|
||||
"--netmasklengthv6", options[:netmask].to_s)
|
||||
end
|
||||
|
||||
# Return the details
|
||||
return {
|
||||
|
@ -320,6 +329,10 @@ module VagrantPlugins
|
|||
info[:ip] = ip
|
||||
elsif netmask = line[/^NetworkMask:\s+(.+?)$/, 1]
|
||||
info[:netmask] = netmask
|
||||
elsif line =~ /^IPV6Address:\s+(.+?)$/
|
||||
info[:ipv6] = $1.to_s.strip
|
||||
elsif line =~ /^IPV6NetworkMaskPrefixLength:\s+(.+?)$/
|
||||
info[:ipv6_prefix] = $1.to_s.strip
|
||||
elsif status = line[/^Status:\s+(.+?)$/, 1]
|
||||
info[:status] = status
|
||||
end
|
||||
|
@ -429,6 +442,11 @@ module VagrantPlugins
|
|||
results
|
||||
end
|
||||
|
||||
def reconfig_host_only(interface)
|
||||
execute("hostonlyif", "ipconfig", interface[:name],
|
||||
"--ipv6", interface[:ipv6])
|
||||
end
|
||||
|
||||
def remove_dhcp_server(network_name)
|
||||
execute("dhcpserver", "remove", "--netname", network_name)
|
||||
end
|
||||
|
|
|
@ -48,10 +48,19 @@ module VagrantPlugins
|
|||
interface = execute("hostonlyif", "create")
|
||||
name = interface[/^Interface '(.+?)' was successfully created$/, 1]
|
||||
|
||||
# Configure it
|
||||
execute("hostonlyif", "ipconfig", name,
|
||||
"--ip", options[:adapter_ip],
|
||||
"--netmask", options[:netmask])
|
||||
# Get the IP so we can determine v4 vs v6
|
||||
ip = IPAddr.new(options[:adapter_ip])
|
||||
|
||||
# Configure
|
||||
if ip.ipv4?
|
||||
execute("hostonlyif", "ipconfig", name,
|
||||
"--ip", options[:adapter_ip],
|
||||
"--netmask", options[:netmask])
|
||||
elsif ip.ipv6?
|
||||
execute("hostonlyif", "ipconfig", name,
|
||||
"--ipv6", options[:adapter_ip],
|
||||
"--netmasklengthv6", options[:netmask].to_s)
|
||||
end
|
||||
|
||||
# Return the details
|
||||
return {
|
||||
|
@ -325,6 +334,10 @@ module VagrantPlugins
|
|||
info[:ip] = ip
|
||||
elsif netmask = line[/^NetworkMask:\s+(.+?)$/, 1]
|
||||
info[:netmask] = netmask
|
||||
elsif line =~ /^IPV6Address:\s+(.+?)$/
|
||||
info[:ipv6] = $1.to_s.strip
|
||||
elsif line =~ /^IPV6NetworkMaskPrefixLength:\s+(.+?)$/
|
||||
info[:ipv6_prefix] = $1.to_s.strip
|
||||
elsif status = line[/^Status:\s+(.+?)$/, 1]
|
||||
info[:status] = status
|
||||
end
|
||||
|
@ -434,6 +447,11 @@ module VagrantPlugins
|
|||
results
|
||||
end
|
||||
|
||||
def reconfig_host_only(interface)
|
||||
execute("hostonlyif", "ipconfig", interface[:name],
|
||||
"--ipv6", interface[:ipv6])
|
||||
end
|
||||
|
||||
def remove_dhcp_server(network_name)
|
||||
execute("dhcpserver", "remove", "--netname", network_name)
|
||||
end
|
||||
|
|
|
@ -46,12 +46,21 @@ module VagrantPlugins
|
|||
def create_host_only_network(options)
|
||||
# Create the interface
|
||||
execute("hostonlyif", "create") =~ /^Interface '(.+?)' was successfully created$/
|
||||
name = $1.to_s
|
||||
name = $1.to_s
|
||||
|
||||
# Configure it
|
||||
execute("hostonlyif", "ipconfig", name,
|
||||
"--ip", options[:adapter_ip],
|
||||
"--netmask", options[:netmask])
|
||||
# Get the IP so we can determine v4 vs v6
|
||||
ip = IPAddr.new(options[:adapter_ip])
|
||||
|
||||
# Configure
|
||||
if ip.ipv4?
|
||||
execute("hostonlyif", "ipconfig", name,
|
||||
"--ip", options[:adapter_ip],
|
||||
"--netmask", options[:netmask])
|
||||
elsif ip.ipv6?
|
||||
execute("hostonlyif", "ipconfig", name,
|
||||
"--ipv6", options[:adapter_ip],
|
||||
"--netmasklengthv6", options[:netmask].to_s)
|
||||
end
|
||||
|
||||
# Return the details
|
||||
return {
|
||||
|
@ -356,6 +365,10 @@ module VagrantPlugins
|
|||
info[:ip] = $1.to_s
|
||||
elsif line =~ /^NetworkMask:\s+(.+?)$/
|
||||
info[:netmask] = $1.to_s
|
||||
elsif line =~ /^IPV6Address:\s+(.+?)$/
|
||||
info[:ipv6] = $1.to_s.strip
|
||||
elsif line =~ /^IPV6NetworkMaskPrefixLength:\s+(.+?)$/
|
||||
info[:ipv6_prefix] = $1.to_s.strip
|
||||
elsif line =~ /^Status:\s+(.+?)$/
|
||||
info[:status] = $1.to_s
|
||||
end
|
||||
|
@ -465,6 +478,11 @@ module VagrantPlugins
|
|||
results
|
||||
end
|
||||
|
||||
def reconfig_host_only(interface)
|
||||
execute("hostonlyif", "ipconfig", interface[:name],
|
||||
"--ipv6", interface[:ipv6])
|
||||
end
|
||||
|
||||
def remove_dhcp_server(network_name)
|
||||
execute("dhcpserver", "remove", "--netname", network_name)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue