Sha256: 50e83bbd9bfadddbbcf94bdfee6d731db240745c1657b553f2af7b33b3c106c5

Contents?: true

Size: 716 Bytes

Versions: 22

Compression:

Stored size: 716 Bytes

Contents

require "log4r"

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

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

          if env[:machine].state.id == :stopped
            env[:ui].info(I18n.t("vagrant_aws.already_status", :status => env[:machine].state.id))
          else
            env[:ui].info(I18n.t("vagrant_aws.stopping"))
            server.stop(!!env[:force_halt])
          end

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

Version data entries

22 entries across 22 versions & 7 rubygems

Version Path
vagrant-aws-0.4.1 lib/vagrant-aws/action/stop_instance.rb
vagrant-aws-0.4.0 lib/vagrant-aws/action/stop_instance.rb