class HashiCorp::VagrantVMwareDesktop::Action::Halt

This stops the VMware machine.

Public Class Methods

new(app, env) click to toggle source
# File lib/vagrant-vmware-desktop/action/halt.rb, line 10
def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new("hashicorp::provider::vmware::halt")
end

Public Instance Methods

call(env) click to toggle source
# File lib/vagrant-vmware-desktop/action/halt.rb, line 15
def call(env)
  if env[:machine].provider.state.id == :running
    env[:ui].info(I18n.t("hashicorp.vagrant_vmware_desktop.stopping"))
    stop_mode = env[:force_halt] ? "hard" : "soft"
    env[:machine].provider.driver.stop(stop_mode)
  end

  @app.call(env)
end