Merge pull request #5233 from mitchellh/virtualbox-dhcpserver-netmask
providers/virtualbox: read netmask from dhcpservers
This commit is contained in:
commit
fa38b59049
|
@ -265,6 +265,8 @@ module VagrantPlugins
|
||||||
info[:network_name] = "HostInterfaceNetworking-#{network}"
|
info[:network_name] = "HostInterfaceNetworking-#{network}"
|
||||||
elsif ip = line[/^IP:\s+(.+?)$/, 1]
|
elsif ip = line[/^IP:\s+(.+?)$/, 1]
|
||||||
info[:ip] = ip
|
info[:ip] = ip
|
||||||
|
elsif netmask = line[/^NetworkMask:\s+(.+?)$/, 1]
|
||||||
|
info[:netmask] = netmask
|
||||||
elsif lower = line[/^lowerIPAddress:\s+(.+?)$/, 1]
|
elsif lower = line[/^lowerIPAddress:\s+(.+?)$/, 1]
|
||||||
info[:lower] = lower
|
info[:lower] = lower
|
||||||
elsif upper = line[/^upperIPAddress:\s+(.+?)$/, 1]
|
elsif upper = line[/^upperIPAddress:\s+(.+?)$/, 1]
|
||||||
|
|
|
@ -270,6 +270,8 @@ module VagrantPlugins
|
||||||
info[:network_name] = "HostInterfaceNetworking-#{network}"
|
info[:network_name] = "HostInterfaceNetworking-#{network}"
|
||||||
elsif ip = line[/^IP:\s+(.+?)$/, 1]
|
elsif ip = line[/^IP:\s+(.+?)$/, 1]
|
||||||
info[:ip] = ip
|
info[:ip] = ip
|
||||||
|
elsif netmask = line[/^NetworkMask:\s+(.+?)$/, 1]
|
||||||
|
info[:netmask] = netmask
|
||||||
elsif lower = line[/^lowerIPAddress:\s+(.+?)$/, 1]
|
elsif lower = line[/^lowerIPAddress:\s+(.+?)$/, 1]
|
||||||
info[:lower] = lower
|
info[:lower] = lower
|
||||||
elsif upper = line[/^upperIPAddress:\s+(.+?)$/, 1]
|
elsif upper = line[/^upperIPAddress:\s+(.+?)$/, 1]
|
||||||
|
|
|
@ -293,6 +293,8 @@ module VagrantPlugins
|
||||||
info[:network_name] = "HostInterfaceNetworking-#{network}"
|
info[:network_name] = "HostInterfaceNetworking-#{network}"
|
||||||
elsif ip = line[/^IP:\s+(.+?)$/, 1]
|
elsif ip = line[/^IP:\s+(.+?)$/, 1]
|
||||||
info[:ip] = ip
|
info[:ip] = ip
|
||||||
|
elsif netmask = line[/^NetworkMask:\s+(.+?)$/, 1]
|
||||||
|
info[:netmask] = netmask
|
||||||
elsif lower = line[/^lowerIPAddress:\s+(.+?)$/, 1]
|
elsif lower = line[/^lowerIPAddress:\s+(.+?)$/, 1]
|
||||||
info[:lower] = lower
|
info[:lower] = lower
|
||||||
elsif upper = line[/^upperIPAddress:\s+(.+?)$/, 1]
|
elsif upper = line[/^upperIPAddress:\s+(.+?)$/, 1]
|
||||||
|
|
|
@ -302,6 +302,8 @@ module VagrantPlugins
|
||||||
info[:network_name] = "HostInterfaceNetworking-#{network}"
|
info[:network_name] = "HostInterfaceNetworking-#{network}"
|
||||||
elsif ip = line[/^IP:\s+(.+?)$/, 1]
|
elsif ip = line[/^IP:\s+(.+?)$/, 1]
|
||||||
info[:ip] = ip
|
info[:ip] = ip
|
||||||
|
elsif netmask = line[/^NetworkMask:\s+(.+?)$/, 1]
|
||||||
|
info[:netmask] = netmask
|
||||||
elsif lower = line[/^lowerIPAddress:\s+(.+?)$/, 1]
|
elsif lower = line[/^lowerIPAddress:\s+(.+?)$/, 1]
|
||||||
info[:lower] = lower
|
info[:lower] = lower
|
||||||
elsif upper = line[/^upperIPAddress:\s+(.+?)$/, 1]
|
elsif upper = line[/^upperIPAddress:\s+(.+?)$/, 1]
|
||||||
|
|
|
@ -37,6 +37,7 @@ shared_examples "a version 4.x virtualbox driver" do |options|
|
||||||
network_name: 'HostInterfaceNetworking-vboxnet0',
|
network_name: 'HostInterfaceNetworking-vboxnet0',
|
||||||
network: 'vboxnet0',
|
network: 'vboxnet0',
|
||||||
ip: '172.28.128.2',
|
ip: '172.28.128.2',
|
||||||
|
netmask: '255.255.255.0',
|
||||||
lower: '172.28.128.3',
|
lower: '172.28.128.3',
|
||||||
upper: '172.28.128.254',
|
upper: '172.28.128.254',
|
||||||
}])
|
}])
|
||||||
|
@ -65,8 +66,8 @@ shared_examples "a version 4.x virtualbox driver" do |options|
|
||||||
|
|
||||||
it "returns a list with one entry for each server" do
|
it "returns a list with one entry for each server" do
|
||||||
expect(subject.read_dhcp_servers).to eq([
|
expect(subject.read_dhcp_servers).to eq([
|
||||||
{network_name: 'HostInterfaceNetworking-vboxnet0', network: 'vboxnet0', ip: '172.28.128.2', lower: '172.28.128.3', upper: '172.28.128.254'},
|
{network_name: 'HostInterfaceNetworking-vboxnet0', network: 'vboxnet0', ip: '172.28.128.2', netmask: '255.255.255.0', lower: '172.28.128.3', upper: '172.28.128.254'},
|
||||||
{network_name: 'HostInterfaceNetworking-vboxnet1', network: 'vboxnet1', ip: '10.0.0.2', lower: '10.0.0.3', upper: '10.0.0.254'},
|
{network_name: 'HostInterfaceNetworking-vboxnet1', network: 'vboxnet1', ip: '10.0.0.2', netmask: '255.255.255.0', lower: '10.0.0.3', upper: '10.0.0.254'},
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue