adjust the fix for #13371 to conform to code elsewhere in the file and check for IPAM

This commit is contained in:
Tom J Nowell 2024-03-28 16:20:52 +00:00 committed by GitHub
parent 5a191b388b
commit ad92256190
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -348,10 +348,10 @@ module VagrantPlugins
network_info = inspect_network(all_networks)
network_info.each do |network|
config = Array(network["IPAM"]["Config"])
if ( config &&
config.size > 0 &&
config.first["Subnet"] == subnet_string)
next if !network["IPAM"]
config = network["IPAM"]["Config"]
next if !config || config.size < 1
if (config.first["Subnet"] == subnet_string)
@logger.debug("Found existing network #{network["Name"]} already configured with #{subnet_string}")
return network["Name"]
end