Class: VagrantPlugins::HYPERKIT::Action::TerminateInstance
- Inherits:
-
Object
- Object
- VagrantPlugins::HYPERKIT::Action::TerminateInstance
- Defined in:
- lib/vagrant-hyperkit/action/terminate_instance.rb
Overview
This terminates the running instance.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ TerminateInstance
constructor
A new instance of TerminateInstance.
- #stop_instance(env) ⇒ Object
Constructor Details
#initialize(app, env) ⇒ TerminateInstance
Returns a new instance of TerminateInstance.
10 11 12 13 |
# File 'lib/vagrant-hyperkit/action/terminate_instance.rb', line 10 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_hyperkit::action::terminate_instance") end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/vagrant-hyperkit/action/terminate_instance.rb', line 15 def call(env) stop_instance(env) # Remove the tracking ID env[:ui].info(I18n.t("vagrant_hyperkit.terminating")) FileUtils.rm_rf(env[:machine].data_dir) @app.call(env) end |
#stop_instance(env) ⇒ Object
24 25 26 27 |
# File 'lib/vagrant-hyperkit/action/terminate_instance.rb', line 24 def stop_instance(env) halt_env = env.dup env[:action_runner].run(Action.action_halt, halt_env) end |