Class: HashiCorp::VagrantVMwareDesktop::Action::Suspend

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/vagrant-vmware-desktop/action/suspend.rb

Overview

This suspends the VMware machine.

Instance Method Summary collapse

Methods included from Common

#to_s

Constructor Details

#initialize(app, env) ⇒ Suspend

Returns a new instance of Suspend.



13
14
15
16
# File 'lib/vagrant-vmware-desktop/action/suspend.rb', line 13

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new("hashicorp::provider::vmware::suspend")
end

Instance Method Details

#call(env) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/vagrant-vmware-desktop/action/suspend.rb', line 18

def call(env)
  if env[:machine].provider.state.id == :running
    env[:ui].info(I18n.t("hashicorp.vagrant_vmware_desktop.suspending"))
    env[:machine].provider.driver.suspend
  end

  @app.call(env)
end