Do not rely on IPAddr#prefix as it's not available on older rubies
This commit is contained in:
parent
8ba69e587c
commit
0575fdfd69
|
@ -43,8 +43,8 @@ module VagrantPlugins
|
|||
if network[:type].to_s == "dhcp"
|
||||
network_content = "DHCP=yes"
|
||||
else
|
||||
cidr = IPAddr.new("255.255.255.255").mask(network[:netmask])
|
||||
address = "#{network[:ip]}/#{cidr.prefix}"
|
||||
prefix = IPAddr.new("255.255.255.255/#{network[:netmask]}").to_i.to_s(2).count("1")
|
||||
address = "#{network[:ip]}/#{prefix}"
|
||||
network_content = "Address=#{address}"
|
||||
end
|
||||
{"name" => unit_name,
|
||||
|
|
Loading…
Reference in New Issue