Convert all VirtualBox provider internals to use new state API
This commit is contained in:
parent
8c4a7350fe
commit
d5c5c4f523
|
@ -34,7 +34,7 @@ module VagrantPlugins
|
|||
|
||||
# If the VM is not starting or running, something went wrong
|
||||
# and we need to show a useful error.
|
||||
state = @env[:machine].provider.state
|
||||
state = @env[:machine].provider.state.id
|
||||
raise Errors::VMFailedToRun if state != :starting && state != :running
|
||||
|
||||
sleep 2 if !@env["vagrant.test"]
|
||||
|
|
|
@ -7,7 +7,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def call(env)
|
||||
if env[:machine].state == :inaccessible
|
||||
if env[:machine].state.id == :inaccessible
|
||||
# The VM we are attempting to manipulate is inaccessible. This
|
||||
# is a very bad situation and can only be fixed by the user. It
|
||||
# also prohibits us from actually doing anything with the virtual
|
||||
|
|
|
@ -9,7 +9,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def call(env)
|
||||
if env[:machine].state == :not_created
|
||||
if env[:machine].state.id == :not_created
|
||||
raise Vagrant::Errors::VMNotCreatedError
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def call(env)
|
||||
if env[:machine].state != :running
|
||||
if env[:machine].state.id != :running
|
||||
raise Vagrant::Errors::VMNotRunningError
|
||||
end
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ module VagrantPlugins
|
|||
|
||||
def call(env)
|
||||
# Set the result to be true if the machine is created.
|
||||
env[:result] = env[:machine].state != :not_created
|
||||
env[:result] = env[:machine].state.id != :not_created
|
||||
|
||||
# Call the next if we have one (but we shouldn't, since this
|
||||
# middleware is built to run with the Call-type middlewares)
|
||||
|
|
|
@ -7,7 +7,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def call(env)
|
||||
if env[:machine].provider.state == :saved
|
||||
if env[:machine].provider.state.id == :saved
|
||||
env[:ui].info I18n.t("vagrant.actions.vm.discard_state.discarding")
|
||||
env[:machine].provider.driver.discard_saved_state
|
||||
end
|
||||
|
|
|
@ -13,7 +13,8 @@ module VagrantPlugins
|
|||
def call(env)
|
||||
@env = env
|
||||
|
||||
raise Vagrant::Errors::VMPowerOffToPackage if @env[:machine].provider.state != :poweroff
|
||||
raise Vagrant::Errors::VMPowerOffToPackage if \
|
||||
@env[:machine].provider.state.id != :poweroff
|
||||
|
||||
setup_temp_dir
|
||||
export
|
||||
|
|
|
@ -7,7 +7,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def call(env)
|
||||
current_state = env[:machine].provider.state
|
||||
current_state = env[:machine].provider.state.id
|
||||
if current_state == :running || current_state == :gurumeditation
|
||||
# If the VM is running and we're not forcing, we can
|
||||
# attempt a graceful shutdown
|
||||
|
@ -17,7 +17,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
# If we're not powered off now, then force it
|
||||
if env[:machine].provider.state != :poweroff
|
||||
if env[:machine].provider.state.id != :poweroff
|
||||
env[:ui].info I18n.t("vagrant.actions.vm.halt.force")
|
||||
env[:machine].provider.driver.halt
|
||||
end
|
||||
|
|
|
@ -33,7 +33,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def recover(env)
|
||||
if env[:machine].provider.state != :not_created
|
||||
if env[:machine].provider.state.id != :not_created
|
||||
return if env["vagrant.error"].is_a?(Vagrant::Errors::VagrantError)
|
||||
|
||||
# Interrupted, destroy the VM. We note that we don't want to
|
||||
|
|
|
@ -8,7 +8,7 @@ module VagrantPlugins
|
|||
|
||||
def call(env)
|
||||
# Set the result to be true if the machine is running.
|
||||
env[:result] = env[:machine].state == :running
|
||||
env[:result] = env[:machine].state.id == :running
|
||||
|
||||
# Call the next if we have one (but we shouldn't, since this
|
||||
# middleware is built to run with the Call-type middlewares)
|
||||
|
|
|
@ -8,7 +8,7 @@ module VagrantPlugins
|
|||
|
||||
def call(env)
|
||||
# Set the result to be true if the machine is saved.
|
||||
env[:result] = env[:machine].state == :saved
|
||||
env[:result] = env[:machine].state.id == :saved
|
||||
|
||||
# Call the next if we have one (but we shouldn't, since this
|
||||
# middleware is built to run with the Call-type middlewares)
|
||||
|
|
|
@ -7,7 +7,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def call(env)
|
||||
if env[:machine].provider.state == :saved
|
||||
if env[:machine].provider.state.id == :saved
|
||||
env[:ui].info I18n.t("vagrant.actions.vm.resume.resuming")
|
||||
env[:action_runner].run(Boot, env)
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def call(env)
|
||||
if env[:machine].provider.state == :running
|
||||
if env[:machine].provider.state.id == :running
|
||||
env[:ui].info I18n.t("vagrant.actions.vm.suspend.suspending")
|
||||
env[:machine].provider.driver.suspend
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue