From 0575fdfd695b56b6d8b2bc4968b2b420bfb7396d Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Fri, 22 Mar 2019 16:42:30 -0700 Subject: [PATCH] Do not rely on IPAddr#prefix as it's not available on older rubies --- plugins/guests/coreos/cap/configure_networks.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/guests/coreos/cap/configure_networks.rb b/plugins/guests/coreos/cap/configure_networks.rb index aa5e17c10..a954b45bd 100644 --- a/plugins/guests/coreos/cap/configure_networks.rb +++ b/plugins/guests/coreos/cap/configure_networks.rb @@ -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,