Class: VagrantPlugins::Skytap::Action::CheckRunning

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-skytap/action/check_running.rb

Overview

This middleware checks that the VM is running, and raises an exception if it is not, notifying the user that the VM must be running.

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ CheckRunning

Returns a new instance of CheckRunning.



29
30
31
# File 'lib/vagrant-skytap/action/check_running.rb', line 29

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

Instance Method Details

#call(env) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/vagrant-skytap/action/check_running.rb', line 33

def call(env)
  if env[:machine].state.id != :running
    raise Vagrant::Errors::VMNotRunningError
  end

  @app.call(env)
end