Sha256: 6ccded2386bc8ebadb87700aa23f616cf62d2e0c2a1af3d76ee408a95e726341

Contents?: true

Size: 622 Bytes

Versions: 3

Compression:

Stored size: 622 Bytes

Contents

require "log4r"

module VagrantPlugins
  module AWS
    module Action
      # This terminates the running instance.
      class TerminateInstance
        def initialize(app, env)
          @app    = app
          @logger = Log4r::Logger.new("vagrant_aws::action::run_instance")
        end

        def call(env)
          server = env[:aws_compute].servers.get(env[:machine].id)

          # Destroy the server and remove the tracking ID
          env[:ui].info(I18n.t("vagrant_aws.terminating"))
          server.destroy
          env[:machine].id = nil

          @app.call(env)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vagrant-aws-0.1.2 lib/vagrant-aws/action/terminate_instance.rb
vagrant-aws-0.1.1 lib/vagrant-aws/action/terminate_instance.rb
vagrant-aws-0.1.0 lib/vagrant-aws/action/terminate_instance.rb