Sha256: c72332b03f81ff042fe18e1a98505c8668d3d485852e52268e07579803c9e1de

Contents?: true

Size: 716 Bytes

Versions: 42

Compression:

Stored size: 716 Bytes

Contents

require "log4r"

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

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

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

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

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
vagrant-mcs-0.8.24 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.23 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.22 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.21 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.20 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.19 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.18 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.17 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.16 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.15 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.12 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.11 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.10 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.9 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.8 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.7 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.6 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.5 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.3 lib/vagrant-mcs/action/stop_instance.rb
vagrant-mcs-0.8.2 lib/vagrant-mcs/action/stop_instance.rb