Sha256: 5f62d6bc4538a645b9eaa7ef120ba815226187cc1077c20d5e9498847c0d4fa3

Contents?: true

Size: 995 Bytes

Versions: 15

Compression:

Stored size: 995 Bytes

Contents

require "log4r"
require 'json'

require 'vagrant-skytap/util/timer'
require 'vagrant-skytap/api/environment'

require 'net/https'
require 'uri'
require 'base64'
require 'json'
require 'timeout'

module VagrantPlugins
  module Skytap
    module Action
      # Stops the Skytap environment and waits until stopped.
      class StopEnvironment
        attr_reader :env

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

        def call(env)
          environment = env[:environment]
          if env[:force_halt]
            environment.poweroff!
          else
            begin
              environment.stop!
            rescue Errors::InstanceReadyTimeout
              @logger.info(I18n.t("vagrant_skytap.graceful_halt_environment_failed"))
              environment.poweroff!
            end
          end
          @app.call(env)
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
vagrant-skytap-0.2.3 lib/vagrant-skytap/action/stop_environment.rb
vagrant-skytap-0.2.2 lib/vagrant-skytap/action/stop_environment.rb
vagrant-skytap-0.2.1 lib/vagrant-skytap/action/stop_environment.rb
vagrant-skytap-0.2.0 lib/vagrant-skytap/action/stop_environment.rb
vagrant-skytap-0.1.11 lib/vagrant-skytap/action/stop_environment.rb
vagrant-skytap-0.1.10 lib/vagrant-skytap/action/stop_environment.rb
vagrant-skytap-0.1.9 lib/vagrant-skytap/action/stop_environment.rb
vagrant-skytap-0.1.8 lib/vagrant-skytap/action/stop_environment.rb
vagrant-skytap-0.1.7 lib/vagrant-skytap/action/stop_environment.rb
vagrant-skytap-0.1.6 lib/vagrant-skytap/action/stop_environment.rb
vagrant-skytap-0.1.5 lib/vagrant-skytap/action/stop_environment.rb
vagrant-skytap-0.1.4 lib/vagrant-skytap/action/stop_environment.rb
vagrant-skytap-0.1.3 lib/vagrant-skytap/action/stop_environment.rb
vagrant-skytap-0.1.2 lib/vagrant-skytap/action/stop_environment.rb
vagrant-skytap-0.1.1a lib/vagrant-skytap/action/stop_environment.rb