Make sure the machine is accessible when checking for the dhcp ip
This commit is contained in:
parent
8507d07862
commit
7b68802dd2
2 changed files with 11 additions and 0 deletions
|
@ -121,6 +121,14 @@ module Vagrant
|
|||
if ip.empty?
|
||||
raise LXC::Errors::ExecuteError, 'Unable to identify container ip'
|
||||
end
|
||||
|
||||
# Sometimes lxc reports the container as running before DNS is returning
|
||||
# the right IP, so have to try a couple of times sometimes.
|
||||
# Tks to https://github.com/neerolyte/vagueant/blob/master/bin/vagueant#L318-L330
|
||||
r = raw "ping -c 1 #{ip} > /dev/null 2>&1"
|
||||
if r.exit_code != 0
|
||||
raise LXC::Errors::ExecuteError, 'Unable to reach container'
|
||||
end
|
||||
end
|
||||
ip
|
||||
end
|
||||
|
|
|
@ -5,6 +5,9 @@ module UnitExampleGroup
|
|||
Object.any_instance.stub(:system) { |*args, &block|
|
||||
UnitExampleGroup.prevent_system_calls(*args, &block)
|
||||
}
|
||||
Object.any_instance.stub(:`) { |*args, &block|
|
||||
UnitExampleGroup.prevent_system_calls(*args, &block)
|
||||
}
|
||||
require 'vagrant/util/subprocess'
|
||||
Vagrant::Util::Subprocess.stub(:execute) { |*args, &block|
|
||||
UnitExampleGroup.prevent_system_calls(*args, &block)
|
||||
|
|
Loading…
Reference in a new issue