Sha256: cbeb45243910e70d6fc4049e585977f55ef560f891e4ebd88a2bc06671c5c5b8

Contents?: true

Size: 723 Bytes

Versions: 1

Compression:

Stored size: 723 Bytes

Contents

require 'uuid'
require "log4r"
require 'vagrant/util/retryable'

module VagrantPlugins
  module Smartos
    class Provider
      # This runs the configured instance.
      class TerminateInstance
        include Vagrant::Util::Retryable

        def initialize(app, env)
          @app    = app
          @logger = Log4r::Logger.new("vagrant_smartos::action::terminate_instance")
        end

        def call(env)
          vm_uuid = env[:machine].id

          if env[:machine].state.id != :not_created
            env[:ui].info(I18n.t("vagrant_smartos.terminating"))
            output = env[:hyp].exec("vmadm destroy #{vm_uuid}")
            env[:machine].id = nil
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-smartos-0.0.2pre1 lib/vagrant-smartos/action/terminate_instance.rb