From 517ac2082261fa0ba83c7dc022a2ed192cf4be61 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 6 Sep 2013 11:30:27 -0700 Subject: [PATCH] guests/coreos: proper guest IP detection [GH-2146] --- CHANGELOG.md | 1 + plugins/guests/coreos/cap/configure_networks.rb | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f5310e21..6dfa88ec8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ BUG FIXES: - core: Handle the case where we get an EACCES cleaning up the .vagrant directory. - core: Fix exception on upgrade warnings from V1 to V2. [GH-2142] + - guests/coreos: Proper IP detection. [GH-2146] - hosts/linux: NFS exporting works properly again. [GH-2137] - provisioners/chef: Work even with restrictive umask on user. [GH-2121] - provisioners/chef: Fix environment validation to be less restrictive. diff --git a/plugins/guests/coreos/cap/configure_networks.rb b/plugins/guests/coreos/cap/configure_networks.rb index 5d992ae91..5a8f52561 100644 --- a/plugins/guests/coreos/cap/configure_networks.rb +++ b/plugins/guests/coreos/cap/configure_networks.rb @@ -28,9 +28,16 @@ module VagrantPlugins primary_machine_config = machine.env.active_machines.first primary_machine = machine.env.machine(*primary_machine_config, true) - get_ip = ->(machine) do - _, network_config = machine.config.vm.networks.detect { |type, _| type == :private_network} - network_config[:ip] + get_ip = lambda do |machine| + ip = nil + machine.config.vm.networks.each do |type, opts| + if type == :private_network && opts[:ip] + ip = opts[:ip] + break + end + end + + ip end primary_machine_ip = get_ip.(primary_machine)