providers/*: use special NOT_CREATED_ID if not created

This commit is contained in:
Mitchell Hashimoto 2014-05-05 21:52:28 -07:00
parent 45fc89877c
commit a34ee404d8
3 changed files with 15 additions and 8 deletions

View File

@ -146,12 +146,14 @@ module VagrantPlugins
state_id = driver.state(@machine.id) if @machine.id && !state_id
state_id = :unknown if !state_id
# If the machine is not created, make sure to clear out machine ID
@machine.id = nil if state_id == :not_created
short = state_id.to_s.gsub("_", " ")
long = I18n.t("docker_provider.status.#{state_id}")
# If we're not created, then specify the special ID flag
if state_id == :not_created
state_id = Vagrant::MachineState::NOT_CREATED_ID
end
Vagrant::MachineState.new(state_id, short, long)
end

View File

@ -67,6 +67,11 @@ module VagrantPlugins
short = state_id.to_s
long = ""
# If we're not created, then specify the special ID flag
if state_id == :not_created
state_id = Vagrant::MachineState::NOT_CREATED_ID
end
# Return the MachineState object
Vagrant::MachineState.new(state_id, short, long)
end

View File

@ -79,15 +79,15 @@ module VagrantPlugins
state_id = @driver.read_state if !state_id
state_id = :unknown if !state_id
# If we're not created, then reset the ID to nil
if state_id == :not_created
@machine.id = nil
end
# Translate into short/long descriptions
short = state_id.to_s.gsub("_", " ")
long = I18n.t("vagrant.commands.status.#{state_id}")
# If we're not created, then specify the special ID flag
if state_id == :not_created
state_id = Vagrant::MachineState::NOT_CREATED_ID
end
# Return the state
Vagrant::MachineState.new(state_id, short, long)
end