Class: VagrantPlugins::ProviderVeertu::Action::CheckAccessible

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-veertu/action/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-veertu/action/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
# File 'lib/vagrant-veertu/action/check_accessible.rb', line 9

def call(env)
  if env[:machine].state.id == :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 Vagrant::Errors::VMInaccessible
  end
  @app.call(env)
end