Sha256: 97a71c8d81e9b4e77fa31f4bc726b20e14a2e6ad0da19dda7d5e5be86247a43d

Contents?: true

Size: 643 Bytes

Versions: 12

Compression:

Stored size: 643 Bytes

Contents

require 'vagrant/util/guest_inspection'

module VagrantPlugins
  module GuestLinux
    module Cap
      class Halt
        extend Vagrant::Util::GuestInspection::Linux

        def self.halt(machine)
          begin
            if systemd?(machine.communicate)
              machine.communicate.sudo("systemctl poweroff")
            else
              machine.communicate.sudo("shutdown -h now")
            end
          rescue IOError, Vagrant::Errors::SSHDisconnected
            # Do nothing, because it probably means the machine shut down
            # and SSH connection was lost.
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
vagrant-unbundled-2.3.6.0 plugins/guests/linux/cap/halt.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/guests/linux/cap/halt.rb
vagrant-unbundled-2.3.3.0 plugins/guests/linux/cap/halt.rb
vagrant-unbundled-2.3.2.0 plugins/guests/linux/cap/halt.rb
vagrant-unbundled-2.2.19.0 plugins/guests/linux/cap/halt.rb
vagrant-unbundled-2.2.18.0 plugins/guests/linux/cap/halt.rb
vagrant-unbundled-2.2.16.0 plugins/guests/linux/cap/halt.rb
vagrant-unbundled-2.2.14.0 plugins/guests/linux/cap/halt.rb
vagrant-aws-mkubenka-0.7.2.pre.24 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-22795b161bf6/plugins/guests/linux/cap/halt.rb
vagrant-unbundled-2.2.10.0 plugins/guests/linux/cap/halt.rb
vagrant-unbundled-2.2.9.0 plugins/guests/linux/cap/halt.rb
vagrant-unbundled-2.2.8.0 plugins/guests/linux/cap/halt.rb