Sha256: d5822a58995db7a1c36cb03f762a43aca405c0290aafb02ddb79e3754a1e5d0f

Contents?: true

Size: 715 Bytes

Versions: 1

Compression:

Stored size: 715 Bytes

Contents

require 'log4r'

module VagrantPlugins
  module Rimu
    module Actions
      # This stops the running instance.
      class StopInstance
        def initialize(app, _env)
          @app    = app
          @logger = Log4r::Logger.new('vagrant_rimu::action::stop_instance')
        end

        def call(env)
          if env[:machine].state.id == :stopped
            env[:ui].info(I18n.t('vagrant_rimu.already_status', :status => env[:machine].state.id))
          else
            env[:ui].info(I18n.t('vagrant_rimu.stopping'))
            client = env[:rimu_api]
            client.servers.shutdown(env[:machine].id.to_i)
          end
          
          @app.call(env)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-rimu-0.0.2 lib/vagrant-rimu/actions/stop_instance.rb