Sha256: 6c0efcd049620d68a042ed94cf7e28fefd05b6a6c0bc7f5bc7ca3ceb3f2f2e1d

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

#
# Copyright (c) 2013, Seth Chisamore
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

module VagrantPlugins
  module Omnibus
    module Action
      # @author Mitchell Hashimoto <mitchell.hashimoto@gmail.com>
      # @author Seth Chisamore <schisamo@opscode.com>
      #
      # This action checks if the machine is up and running.
      #
      # This is a direct copy of
      # `VagrantPlugins::ProviderVirtualBox::Action::IsRunning` that is part of
      # the VirtualBox provider that ships in core Vagrant.
      #
      # @todo find out why this isn't part of `Vagrant::Action::Builtin`
      class IsRunning
        def initialize(app, env)
          @app = app
        end

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

          # 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

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-omnibus-1.0.1 lib/vagrant-omnibus/action/is_running.rb