From 9a16af10ad567d453dc2d0b01f0e7b63de8188c0 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 14 Mar 2014 16:34:14 -0700 Subject: [PATCH] core: Use Machine#state wherever possible so we update the index --- lib/vagrant/action/builtin/wait_for_communicator.rb | 2 +- plugins/providers/virtualbox/action/discard_state.rb | 2 +- plugins/providers/virtualbox/action/export.rb | 2 +- plugins/providers/virtualbox/action/import.rb | 2 +- plugins/providers/virtualbox/action/resume.rb | 2 +- plugins/providers/virtualbox/action/suspend.rb | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/vagrant/action/builtin/wait_for_communicator.rb b/lib/vagrant/action/builtin/wait_for_communicator.rb index c69784629..0890fca47 100644 --- a/lib/vagrant/action/builtin/wait_for_communicator.rb +++ b/lib/vagrant/action/builtin/wait_for_communicator.rb @@ -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 diff --git a/plugins/providers/virtualbox/action/discard_state.rb b/plugins/providers/virtualbox/action/discard_state.rb index b7d9753ea..3f3d5da97 100644 --- a/plugins/providers/virtualbox/action/discard_state.rb +++ b/plugins/providers/virtualbox/action/discard_state.rb @@ -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 diff --git a/plugins/providers/virtualbox/action/export.rb b/plugins/providers/virtualbox/action/export.rb index 1a7df0620..ca3c3519f 100644 --- a/plugins/providers/virtualbox/action/export.rb +++ b/plugins/providers/virtualbox/action/export.rb @@ -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 diff --git a/plugins/providers/virtualbox/action/import.rb b/plugins/providers/virtualbox/action/import.rb index ce091bc6d..4c195d891 100644 --- a/plugins/providers/virtualbox/action/import.rb +++ b/plugins/providers/virtualbox/action/import.rb @@ -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 diff --git a/plugins/providers/virtualbox/action/resume.rb b/plugins/providers/virtualbox/action/resume.rb index a2573e1a0..5b2e055fc 100644 --- a/plugins/providers/virtualbox/action/resume.rb +++ b/plugins/providers/virtualbox/action/resume.rb @@ -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") diff --git a/plugins/providers/virtualbox/action/suspend.rb b/plugins/providers/virtualbox/action/suspend.rb index af4d1cc9e..53a08edfc 100644 --- a/plugins/providers/virtualbox/action/suspend.rb +++ b/plugins/providers/virtualbox/action/suspend.rb @@ -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