Sha256: 7a332116912910f0e0facf9907bcf209fa44feb17d39399d9d8a800e18297b05

Contents?: true

Size: 544 Bytes

Versions: 6

Compression:

Stored size: 544 Bytes

Contents

module Vagrant
  module Actions
    module VM
      class Halt < Base
        def execute!
          raise ActionException.new(:vm_not_running) unless @runner.vm.running?

          @runner.invoke_around_callback(:halt) do
            @runner.system.halt if !options[:force]

            if @runner.vm.state(true) != :powered_off
              logger.info "Forcing shutdown of VM..."
              @runner.vm.stop
            end
          end
        end

        def force?
          !!options[:force]
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
vagrantup-0.4.3.dev lib/vagrant/actions/vm/halt.rb
vagrantup-0.4.1 lib/vagrant/actions/vm/halt.rb
vagrantup-0.4.0 lib/vagrant/actions/vm/halt.rb
vagrant-0.4.2 lib/vagrant/actions/vm/halt.rb
vagrant-0.4.1 lib/vagrant/actions/vm/halt.rb
vagrant-0.4.0 lib/vagrant/actions/vm/halt.rb