Sha256: 5b9dedd639243b7ada91ffa4bf1ec133e20d9687038d8f2bf12789a1e3107061

Contents?: true

Size: 806 Bytes

Versions: 1

Compression:

Stored size: 806 Bytes

Contents

require 'log4r'

require 'vagrant-deltacloud-provider/action/abstract_action'
require 'vagrant-deltacloud-provider/client/deltacloud'

module VagrantPlugins
  module Deltacloud
    module Action
      class StopServer < AbstractAction
        def initialize(app, _env)
          @app    = app
          @logger = Log4r::Logger.new('vagrant_deltacloud::action::stop_server')
        end

        def execute(env)
          env[:deltacloud_client] = Deltacloud::DeltacloudClient.instance
          if env[:machine].id
            @logger.info "Stopping server #{env[:machine].id}..."
            env[:ui].info(I18n.t('vagrant_deltacloud.stopping_server'))
            env[:deltacloud_client].stop_instance(env, env[:machine].id)
          end
          @app.call(env)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-deltacloud-provider-0.0.9 lib/vagrant-deltacloud-provider/action/stop_server.rb