Chris Roberts 571659a5d1 guests/openbsd: include -h option on shutdown
For OpenBSD versions prior to 5.7 the `-h` option _must_ be provided
to the `shutdown` command when `-p` is used. Later versions no longer
require the `-h` option but still allow it for compatibility.

http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/shutdown/shutdown.8?rev=1.40&content-type=text/x-cvsweb-markup
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/shutdown/shutdown.c?rev=1.40&content-type=text/x-cvsweb-markup
2016-08-10 09:14:08 -07:00

20 lines
606 B
Ruby

module VagrantPlugins
module GuestOpenBSD
module Cap
class Halt
def self.halt(machine)
begin
# Versions of OpenBSD prior to 5.7 require the -h option to be
# provided with the -p option. Later options allow the -h to
# be optional.
machine.communicate.sudo("/sbin/shutdown -p -h now", shell: "sh")
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