Sha256: 602549463c2d87d356e3d6d0ba8f1f8d4c0222467d16f1288748e92ef1512551

Contents?: true

Size: 591 Bytes

Versions: 8

Compression:

Stored size: 591 Bytes

Contents

require 'i18n'

module VagrantPlugins
  module VCenter
    module Action
      # This class sets the state to suspended if the VM is suspended.
      class IsPaused
        def initialize(app, env)
          @app = app
        end

        def call(env)
          # Set the result to be true if the machine is suspended.
          env[:result] = env[:machine].state.id == :suspended

          # Call the next if we have one (but we shouldn't, since this
          # middleware is built to run with the Call-type middlewares)
          @app.call(env)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vagrant-vcenter-0.3.2 lib/vagrant-vcenter/action/is_paused.rb
vagrant-vcenter-0.3.1 lib/vagrant-vcenter/action/is_paused.rb
vagrant-vcenter-0.3.0 lib/vagrant-vcenter/action/is_paused.rb
vagrant-vcenter-0.2.1 lib/vagrant-vcenter/action/is_paused.rb
vagrant-vcenter-0.2.0 lib/vagrant-vcenter/action/is_paused.rb
vagrant-vcenter-0.1.1 lib/vagrant-vcenter/action/is_paused.rb
vagrant-vcenter-0.1.0 lib/vagrant-vcenter/action/is_paused.rb
vagrant-vcenter-0.0.2.pre.dev lib/vagrant-vcenter/action/is_paused.rb