From be096c3ef4b41f463d06f2cbd5835a9670e9174e Mon Sep 17 00:00:00 2001 From: Igor Mazur Date: Mon, 21 May 2018 23:48:40 +0300 Subject: [PATCH 1/3] Fix for ubuntu 17.10+ netplan https://github.com/hashicorp/vagrant/issues/9570 --- plugins/guests/debian/cap/configure_networks.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/guests/debian/cap/configure_networks.rb b/plugins/guests/debian/cap/configure_networks.rb index 6ba4c2ca9..5f35b874d 100644 --- a/plugins/guests/debian/cap/configure_networks.rb +++ b/plugins/guests/debian/cap/configure_networks.rb @@ -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] From 07bbaf9ac5ea0ebd87333971f3b68c1846e23916 Mon Sep 17 00:00:00 2001 From: Igor Mazur Date: Tue, 22 May 2018 23:29:53 +0300 Subject: [PATCH 2/3] Fix fo tests (symbol and string dhcp) --- plugins/guests/debian/cap/configure_networks.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/guests/debian/cap/configure_networks.rb b/plugins/guests/debian/cap/configure_networks.rb index 5f35b874d..bde7957e9 100644 --- a/plugins/guests/debian/cap/configure_networks.rb +++ b/plugins/guests/debian/cap/configure_networks.rb @@ -37,7 +37,7 @@ module VagrantPlugins ethernets = {}.tap do |e_nets| networks.each do |network| e_config = {}.tap do |entry| - if network[:type] == :dhcp + if network[:type] == :dhcp || network[:type] == "dhcp" entry["dhcp4"] = true else mask = network[:netmask] From 66b28663730f7a0df7f7777b41efef768d3f0ace Mon Sep 17 00:00:00 2001 From: Igor Mazur Date: Wed, 23 May 2018 11:17:40 +0300 Subject: [PATCH 3/3] Shorten if --- plugins/guests/debian/cap/configure_networks.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/guests/debian/cap/configure_networks.rb b/plugins/guests/debian/cap/configure_networks.rb index bde7957e9..4747b2e19 100644 --- a/plugins/guests/debian/cap/configure_networks.rb +++ b/plugins/guests/debian/cap/configure_networks.rb @@ -37,7 +37,7 @@ module VagrantPlugins ethernets = {}.tap do |e_nets| networks.each do |network| e_config = {}.tap do |entry| - if network[:type] == :dhcp || network[:type] == "dhcp" + if network[:type].to_s == "dhcp" entry["dhcp4"] = true else mask = network[:netmask]