From f24dba0dc5724a5ad2ff869d6f13814aa5565ff2 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 21 Jan 2013 11:34:04 -0600 Subject: [PATCH] VirtualBox provider returns new MachineState object --- plugins/providers/virtualbox/provider.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/plugins/providers/virtualbox/provider.rb b/plugins/providers/virtualbox/provider.rb index c681014da..c955af910 100644 --- a/plugins/providers/virtualbox/provider.rb +++ b/plugins/providers/virtualbox/provider.rb @@ -63,10 +63,19 @@ module VagrantPlugins def state # XXX: What happens if we destroy the VM but the UUID is still # set here? - return :not_created if !@driver.uuid - state = @driver.read_state - return :unknown if !state - state + + # Determine the ID of the state here. + state_id = nil + state_id = :not_created if !@driver.uuid + state_id = @driver.read_state if !state_id + state_id = :unknown if !state_id + + # Translate into short/long descriptions + short = state_id.to_s + long = I18n.t("vagrant.commands.state.#{state_id}") + + # Return the state + Vagrant::MachineState.new(state_id, short, long) end # Returns a human-friendly string version of this provider which