Sha256: 966f342d61cc77075f3f4e72acd3f62a8a80b8172d337b30c341c141dceb08d6

Contents?: true

Size: 815 Bytes

Versions: 7

Compression:

Stored size: 815 Bytes

Contents

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

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

        def execute(env)
          env[:deltacloud_client] = Deltacloud::DeltacloudClient.instance
          if env[:machine].id
            @logger.info "Saving VM #{env[:machine].id} state and suspending execution..."
            env[:ui].info I18n.t('vagrant.actions.vm.suspend.suspending')
            env[:deltacloud_client].suspend_server(env, env[:machine].id)
          end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vagrant-deltacloud-provider-0.0.8 lib/vagrant-deltacloud-provider/action/suspend.rb
vagrant-deltacloud-provider-0.0.7 lib/vagrant-deltacloud-provider/action/suspend.rb
vagrant-deltacloud-provider-0.0.6 lib/vagrant-deltacloud-provider/action/suspend.rb
vagrant-deltacloud-provider-0.0.5 lib/vagrant-deltacloud-provider/action/suspend.rb
vagrant-deltacloud-provider-0.0.4 lib/vagrant-deltacloud-provider/action/suspend.rb
vagrant-deltacloud-provider-0.0.3 lib/vagrant-deltacloud-provider/action/suspend.rb
vagrant-deltacloud-provider-0.0.2 lib/vagrant-deltacloud-provider/action/suspend.rb