plugins/providers/virtualbox/action/import.rb in vagrant-unbundled-2.2.19.0 vs plugins/providers/virtualbox/action/import.rb in vagrant-unbundled-2.3.2.0

- old
+ new

@@ -77,11 +77,11 @@ # Import completed successfully. Continue the chain @app.call(env) end def recover(env) - if env[:machine] && env[:machine].state.id != :not_created + if env[:machine] && env[:machine].state.id != Vagrant::MachineState::NOT_CREATED_ID return if env["vagrant.error"].is_a?(Vagrant::Errors::VagrantError) # If we're not supposed to destroy on error then just return return if !env[:destroy_on_error] @@ -89,9 +89,16 @@ # validate the configuration here, and we don't want to confirm # we want to destroy. destroy_env = env.clone destroy_env[:config_validate] = false destroy_env[:force_confirm_destroy] = true + + # We don't want to double-execute any hooks attached to + # machine_action_up. Instead we should be honoring destroy hooks. + # Changing the action name here should make the Builder do the + # right thing. + destroy_env[:raw_action_name] = :destroy + destroy_env[:action_name] = :machine_action_destroy env[:action_runner].run(Action.action_destroy, destroy_env) end end end end