Class: HashiCorp::VagrantVMwareDesktop::Action::DiscardSuspendedState
- Inherits:
-
Object
- Object
- HashiCorp::VagrantVMwareDesktop::Action::DiscardSuspendedState
- Includes:
- Common
- Defined in:
- lib/vagrant-vmware-desktop/action/discard_suspended_state.rb
Overview
This discards the suspended state of the machine.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ DiscardSuspendedState
constructor
A new instance of DiscardSuspendedState.
Methods included from Common
Constructor Details
#initialize(app, env) ⇒ DiscardSuspendedState
Returns a new instance of DiscardSuspendedState.
13 14 15 16 |
# File 'lib/vagrant-vmware-desktop/action/discard_suspended_state.rb', line 13 def initialize(app, env) @app = app @logger = Log4r::Logger.new("hashicorp::provider::vmware::discard_suspended_state") end |
Instance Method Details
#call(env) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/vagrant-vmware-desktop/action/discard_suspended_state.rb', line 18 def call(env) machine_state = env[:machine].provider.state.id if machine_state == :suspended env[:ui].info(I18n.t("hashicorp.vagrant_vmware_desktop.discarding_suspended_state")) end if machine_state != :not_created # We don't care if the machine is suspended or not, just always # delete the suspended state if it is created, since that is our job env[:machine].provider.driver.discard_suspended_state end @app.call(env) end |