Method: Vagrant::Action::Warden#call

Defined in:
lib/vagrant/action/warden.rb

#call(env) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/vagrant/action/warden.rb', line 24

def call(env)
  return if @actions.empty?

  begin
    # Call the next middleware in the sequence, appending to the stack
    # of "recoverable" middlewares in case something goes wrong!
    raise Errors::VagrantInterrupt if env[:interrupted]
    action = @actions.shift
    @logger.info("Calling action: #{action}")
    @stack.unshift(action).first.call(env)
    raise Errors::VagrantInterrupt if env[:interrupted]
  rescue SystemExit
    # This means that an "exit" or "abort" was called. In these cases,
    # we just exit immediately.
    raise
  rescue Exception => e
    @logger.error("Error occurred: #{e}")
    env["vagrant.error"] = e

    # Something went horribly wrong. Start the rescue chain then
    # reraise the exception to properly kick us out of limbo here.
    begin_rescue(env)
    raise
  end
end