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