Class: Vagrant::Action::VM::CheckAccessible

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/action/vm/check_accessible.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ CheckAccessible

Returns a new instance of CheckAccessible.



5
6
7
# File 'lib/vagrant/action/vm/check_accessible.rb', line 5

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

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/vagrant/action/vm/check_accessible.rb', line 9

def call(env)
  if env[:vm].state == :inaccessible
    # The VM we are attempting to manipulate is inaccessible. This
    # is a very bad situation and can only be fixed by the user. It
    # also prohibits us from actually doing anything with the virtual
    # machine, so we raise an error.
    raise Errors::VMInaccessible
  end

  @app.call(env)
end