class VagrantPlugins::ProviderLibvirt::Action::SetupComplete

Public Class Methods

new(app, _env) click to toggle source
# File lib/vagrant-libvirt/action/cleanup_on_failure.rb, line 55
def initialize(app, _env)
  @logger = Log4r::Logger.new('vagrant_libvirt::action::setup_complete')
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/vagrant-libvirt/action/cleanup_on_failure.rb, line 60
def call(env)
  if env['vagrant-libvirt.complete'].nil? or !env['vagrant-libvirt.complete'].respond_to? :call
    raise Errors::CallChainError, require_action: CleanupOnFailure.name, current_action: SetupComplete.name
  end

  @logger.debug('Marking provider setup as completed')
  # mark provider as finished setup so that any failure after this
  # point doesn't result in destroying or shutting down the VM
  env['vagrant-libvirt.complete'].call

  @app.call(env)
end