Fix for ubuntu 17.10+ netplan

https://github.com/hashicorp/vagrant/issues/9570
This commit is contained in:
Igor Mazur 2018-05-21 23:48:40 +03:00 committed by GitHub
parent dfb2a9e823
commit be096c3ef4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -37,7 +37,9 @@ module VagrantPlugins
ethernets = {}.tap do |e_nets|
networks.each do |network|
e_config = {}.tap do |entry|
if network[:ip]
if network[:type] == :dhcp
entry["dhcp4"] = true
else
mask = network[:netmask]
if mask && IPAddr.new(network[:ip]).ipv4?
begin
@ -47,8 +49,6 @@ module VagrantPlugins
end
end
entry["addresses"] = [[network[:ip], mask].compact.join("/")]
else
entry["dhcp4"] = true
end
if network[:gateway]
entry["gateway4"] = network[:gateway]