Sha256: 6fa213ab53f2ee6dd4dff00b58ba5b3a79613efe83560add8f80e88f3d98070a

Contents?: true

Size: 608 Bytes

Versions: 4

Compression:

Stored size: 608 Bytes

Contents

require "log4r"

module VagrantPlugins
  module OpenStack
    module Action
      # This pauses a running server, if there is one.
      class PauseServer
        def initialize(app, env)
          @app    = app
          @logger = Log4r::Logger.new("vagrant_openstack::action::pause_server")
        end

        def call(env)
          if env[:machine].id
            env[:ui].info(I18n.t("vagrant_openstack.pausing_server"))
            server = env[:openstack_compute].servers.get(env[:machine].id)
            server.pause
          end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vagrant-openstack-plugin-0.6.1 lib/vagrant-openstack-plugin/action/pause_server.rb
vagrant-openstack-plugin-0.6.0 lib/vagrant-openstack-plugin/action/pause_server.rb
vagrant-openstack-plugin-0.5.0 lib/vagrant-openstack-plugin/action/pause_server.rb
vagrant-openstack-plugin-0.4.1 lib/vagrant-openstack-plugin/action/pause_server.rb