plugins/providers/virtualbox/action/network.rb in vagrant-unbundled-2.3.3.0 vs plugins/providers/virtualbox/action/network.rb in vagrant-unbundled-2.3.6.0
- old
+ new
@@ -69,9 +69,24 @@
# Internal network is a special type
if type == :private_network && options[:intnet]
type = :internal_network
end
+ if !options.key?(:type) && options.key?(:ip)
+ begin
+ addr = IPAddr.new(options[:ip])
+ options[:type] = if addr.ipv4?
+ :static
+ else
+ :static6
+ end
+ rescue IPAddr::Error => err
+ raise Vagrant::Errors::NetworkAddressInvalid,
+ address: options[:ip], mask: options[:netmask],
+ error: err.message
+ end
+ end
+
# Configure it
data = nil
if type == :private_network
# private_network = hostonly
data = [:hostonly, options]