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?
|
if ip.empty?
|
||||||
raise LXC::Errors::ExecuteError, 'Unable to identify container ip'
|
raise LXC::Errors::ExecuteError, 'Unable to identify container ip'
|
||||||
end
|
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
|
end
|
||||||
ip
|
ip
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,9 @@ module UnitExampleGroup
|
||||||
Object.any_instance.stub(:system) { |*args, &block|
|
Object.any_instance.stub(:system) { |*args, &block|
|
||||||
UnitExampleGroup.prevent_system_calls(*args, &block)
|
UnitExampleGroup.prevent_system_calls(*args, &block)
|
||||||
}
|
}
|
||||||
|
Object.any_instance.stub(:`) { |*args, &block|
|
||||||
|
UnitExampleGroup.prevent_system_calls(*args, &block)
|
||||||
|
}
|
||||||
require 'vagrant/util/subprocess'
|
require 'vagrant/util/subprocess'
|
||||||
Vagrant::Util::Subprocess.stub(:execute) { |*args, &block|
|
Vagrant::Util::Subprocess.stub(:execute) { |*args, &block|
|
||||||
UnitExampleGroup.prevent_system_calls(*args, &block)
|
UnitExampleGroup.prevent_system_calls(*args, &block)
|
||||||
|
|
Loading…
Add table
Reference in a new issue