# frozen_string_literal: true

require 'log4r'

module VagrantPlugins
  module ProviderLocal
    module Action
      # This will halt the instance
      class Halt
        def initialize(app, _env)
          @logger = Log4r::Logger.new('vagrant_local::action::import')
          @app = app
        end

        def call(env)
          @machine = env[:machine]
          @driver  = @machine.provider.driver
          @driver.halt(env[:ui])
          @app.call(env)
        end
      end
    end
  end
end