Merge pull request #318 from rtkrruvinskiy/lock_race

Work around WaitForCommunicator lock race condition
This commit is contained in:
Fabio Rehm 2014-10-15 00:31:10 -03:00
commit b4a642bc8a
2 changed files with 5 additions and 10 deletions

View file

@ -197,14 +197,9 @@ module Vagrant
# is expected to be put into the `:machine_ip` key. # is expected to be put into the `:machine_ip` key.
def self.action_fetch_ip def self.action_fetch_ip
Builder.new.tap do |b| Builder.new.tap do |b|
b.use Builtin::ConfigValidate b.use Builtin::Call, Builtin::ConfigValidate do |env, b2|
b.use Builtin::Call, Builtin::IsState, :running do |env, b2|
if env[:result]
b2.use FetchIpWithLxcAttach if env[:machine].provider.driver.supports_attach? b2.use FetchIpWithLxcAttach if env[:machine].provider.driver.supports_attach?
b2.use FetchIpFromDnsmasqLeases b2.use FetchIpFromDnsmasqLeases
else
b2.use Builtin::Message, I18n.t("vagrant_lxc.messages.not_running")
end
end end
end end
end end

View file

@ -64,9 +64,9 @@ module Vagrant
# Returns the SSH info for accessing the Container. # Returns the SSH info for accessing the Container.
def ssh_info def ssh_info
# If the Container is not created then we cannot possibly SSH into it, so # If the Container is not running then we cannot possibly SSH into it, so
# we return nil. # we return nil.
return nil if state == :not_created return nil if state.id != :running
# Run a custom action called "fetch_ip" which does what it says and puts # Run a custom action called "fetch_ip" which does what it says and puts
# the IP found into the `:machine_ip` key in the environment. # the IP found into the `:machine_ip` key in the environment.