core: Use Machine#state wherever possible so we update the index

This commit is contained in:
Mitchell Hashimoto 2014-03-14 16:34:14 -07:00
parent e14216da4e
commit 9a16af10ad
6 changed files with 6 additions and 6 deletions

View File

@ -33,7 +33,7 @@ module Vagrant
# Otherwise, periodically verify the VM isn't in a bad state.
while true
state = env[:machine].provider.state.id
state = env[:machine].state.id
# Used to report invalid states
Thread.current[:last_known_state] = state

View File

@ -7,7 +7,7 @@ module VagrantPlugins
end
def call(env)
if env[:machine].provider.state.id == :saved
if env[:machine].state.id == :saved
env[:ui].info I18n.t("vagrant.actions.vm.discard_state.discarding")
env[:machine].provider.driver.discard_saved_state
end

View File

@ -12,7 +12,7 @@ module VagrantPlugins
@env = env
raise Vagrant::Errors::VMPowerOffToPackage if \
@env[:machine].provider.state.id != :poweroff
@env[:machine].state.id != :poweroff
export

View File

@ -33,7 +33,7 @@ module VagrantPlugins
end
def recover(env)
if env[:machine].provider.state.id != :not_created
if env[:machine].state.id != :not_created
return if env["vagrant.error"].is_a?(Vagrant::Errors::VagrantError)
# If we're not supposed to destroy on error then just return

View File

@ -7,7 +7,7 @@ module VagrantPlugins
end
def call(env)
current_state = env[:machine].provider.state.id
current_state = env[:machine].state.id
if current_state == :paused
env[:ui].info I18n.t("vagrant.actions.vm.resume.unpausing")

View File

@ -7,7 +7,7 @@ module VagrantPlugins
end
def call(env)
if env[:machine].provider.state.id == :running
if env[:machine].state.id == :running
env[:ui].info I18n.t("vagrant.actions.vm.suspend.suspending")
env[:machine].provider.driver.suspend
end