providers/virtualbox: fix some crashing bugs

This commit is contained in:
Mitchell Hashimoto 2015-10-06 16:22:48 -04:00
parent 3b3de6e2e5
commit 0586412f9d
3 changed files with 10 additions and 9 deletions

View File

@ -18,6 +18,7 @@ module VagrantPlugins
end end
# Set the machine ID # Set the machine ID
env[:machine_id] = id
env[:machine].id = id if !env[:skip_machine] env[:machine].id = id if !env[:skip_machine]
# Clear the line one last time since the progress meter doesn't disappear # Clear the line one last time since the progress meter doesn't disappear
@ -29,14 +30,14 @@ module VagrantPlugins
return if env[:interrupted] return if env[:interrupted]
# Flag as erroneous and return if import failed # Flag as erroneous and return if import failed
raise Vagrant::Errors::VMImportFailure if !env[:machine].id raise Vagrant::Errors::VMImportFailure if !id
# Import completed successfully. Continue the chain # Import completed successfully. Continue the chain
@app.call(env) @app.call(env)
end end
def recover(env) def recover(env)
if env[:machine].state.id != :not_created if env[:machine] && env[:machine].state.id != :not_created
return if env["vagrant.error"].is_a?(Vagrant::Errors::VagrantError) return if env["vagrant.error"].is_a?(Vagrant::Errors::VagrantError)
# If we're not supposed to destroy on error then just return # If we're not supposed to destroy on error then just return

View File

@ -49,10 +49,10 @@ module VagrantPlugins
end end
env[:ui].info(I18n.t("vagrant.actions.vm.clone.setup_master")) env[:ui].info(I18n.t("vagrant.actions.vm.clone.setup_master"))
env[:ui].detail("\n"+I18n.t("vagrant.actions.vm.clone.setup_master_detail")) env[:ui].detail(I18n.t("vagrant.actions.vm.clone.setup_master_detail"))
# Import the virtual machine # Import the virtual machine
import_env = env[:action_runner].run(Import, skip_machine: true) import_env = env[:action_runner].run(Import, env.dup.merge(skip_machine: true))
env[:master_id] = import_env[:machine_id] env[:master_id] = import_env[:machine_id]
@logger.info( @logger.info(