Closed ekohl closed 6 years ago
@ekohl I'm curious to know how you end up in this situation. Because if you have several networks in your project but no network specified in your Vagrantfile you can't create the instance. vagrant up
fails with the message
Multiple possible networks found, use a Network ID to be more specific.
By the way, I see a use case. If you first have only one network in your project, you vagrant up
your instance, then you create a second network in the project. The next vagrant ssh
fails.
I'm wondering if this is your use case or if you have another one (just to be sure we don't miss something) because in your snippet you have a network called "public". This is why I suppose both your private and public network exist before you run the vagrant up
command. And in this case this issue can't occur given that vagrant will refuse to create the instance.
By the way, this fix is good to merge. But if you have more information, I'll appreciate.
Related to theforeman/foreman-infra/pull/518
@ggiamarchi I'm not sure how it was actually set up. We're using Rackspace. There a VM gets a public network with both globally routable v4 and v6 IPs. It also gets a private network with a RFC1918 IP for management purposes. Those networks existed from before I started to get involved.
When a VM has multiple addresses but no networks assigned in the config the current code fails because env[:machine].provider_config.networks is nil.
The content of addresses:
Fixes GH-289