Class: VagrantPlugins::Utm::Action::ForcedHalt
- Inherits:
-
Object
- Object
- VagrantPlugins::Utm::Action::ForcedHalt
- Defined in:
- lib/vagrant_utm/action/forced_halt.rb
Overview
This action is responsible for halting (stopping) the VM.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, _env) ⇒ ForcedHalt
constructor
A new instance of ForcedHalt.
Constructor Details
#initialize(app, _env) ⇒ ForcedHalt
Returns a new instance of ForcedHalt.
8 9 10 |
# File 'lib/vagrant_utm/action/forced_halt.rb', line 8 def initialize(app, _env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/vagrant_utm/action/forced_halt.rb', line 12 def call(env) current_state = env[:machine].state.id if current_state == :started env[:ui].info I18n.t("vagrant.actions.vm.halt.force") env[:machine].provider.driver.halt end # Sleep for a second to verify that the VM properly # cleans itself up. sleep 1 unless env["vagrant.test"] @app.call(env) end |