providers/docker: cleaner action stacks

This commit is contained in:
Mitchell Hashimoto 2014-04-17 17:11:00 -07:00
parent 35d9256137
commit d1b3165545
2 changed files with 21 additions and 2 deletions

View File

@ -9,8 +9,25 @@ module VagrantPlugins
def self.action_up def self.action_up
Vagrant::Action::Builder.new.tap do |b| Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate b.use ConfigValidate
b.use HandleBox
b.use Call, IsState, :not_created do |env, b2|
if env[:result]
b2.use HandleBox
end
end
b.use HostMachine b.use HostMachine
# Yeah, this is supposed to be here twice (once more above). This
# catches the case when the container was supposed to be created,
# but the host state was unknown, and now we know its not actually
# created.
b.use Call, IsState, :not_created do |env, b2|
if env[:result]
b2.use HandleBox
end
end
b.use action_start b.use action_start
end end
end end

View File

@ -141,7 +141,9 @@ module VagrantPlugins
def state def state
state_id = nil state_id = nil
state_id = :host_state_unknown if host_vm? && !host_vm.communicate.ready? state_id = :not_created if !@machine.id
state_id = :host_state_unknown if !state_id && \
host_vm? && !host_vm.communicate.ready?
state_id = :not_created if !state_id && \ state_id = :not_created if !state_id && \
(!@machine.id || !driver.created?(@machine.id)) (!@machine.id || !driver.created?(@machine.id))
state_id = driver.state(@machine.id) if @machine.id && !state_id state_id = driver.state(@machine.id) if @machine.id && !state_id