Class: VagrantPlugins::Utm::Action::CheckRunning

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant_utm/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. UTM equivalent status is “started”

Instance Method Summary collapse

Constructor Details

#initialize(app, _env) ⇒ CheckRunning

Returns a new instance of CheckRunning.



13
14
15
# File 'lib/vagrant_utm/action/check_running.rb', line 13

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

Instance Method Details

#call(env) ⇒ Object

Raises:

  • (Vagrant::Errors::VMNotRunningError)


17
18
19
20
21
# File 'lib/vagrant_utm/action/check_running.rb', line 17

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

  @app.call(env)
end