lib/vagrant-shell/action/terminate_instance.rb in vagrant-shell-0.2.13 vs lib/vagrant-shell/action/terminate_instance.rb in vagrant-shell-0.2.14
- old
+ new
@@ -9,18 +9,14 @@
@app = app
@logger = Log4r::Logger.new("vagrant_shell::action::terminate_instance")
end
def call(env)
+ server = env[:script].servers.get(env[:machine].id)
+
# Destroy the server and remove the tracking ID
env[:ui].info(I18n.t("vagrant_shell.terminating"))
- output = %x{ #{env[:machine].provider_config.script} terminate-instance #{env[:machine].id}}
- if $?.to_i > 0
- raise Errors::ShellError, :message => "Failure: #{env[:machine].provider_config.script} terminate-instance #{env[:machine].id}"
- end
-
- puts output
-
+ server.destroy
env[:machine].id = nil
@app.call(env)
end
end