Class: VagrantPlugins::VCenter::Action::IsRunning

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-vcenter/action/is_running.rb

Overview

This class sets the state to running if the VM is running.

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ IsRunning

Returns a new instance of IsRunning.



8
9
10
# File 'lib/vagrant-vcenter/action/is_running.rb', line 8

def initialize(app, env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/vagrant-vcenter/action/is_running.rb', line 12

def call(env)
  # Set the result to be true if the machine is running.
  env[:result] = env[:machine].state.id == :running

  # Call the next if we have one (but we shouldn't, since this
  # middleware is built to run with the Call-type middlewares)
  @app.call(env)
end