Mitchell Hashimoto 459d82689e Get rid of autoload use in Guests
I don't use `activated` here because I'd really like to optimize
performance as much as possible, and loading files from disk is
generally slow. So instead of using `activated` I load the file at the
last possible moment which is when the exact class is being requested.

I don't think many people will do this outside of the core, and I'm not
too concerned.
2012-05-23 15:57:43 -07:00

25 lines
616 B
Ruby

require "vagrant"
require Vagrant.source_root.join("plugins/guests/linux/guest")
module VagrantPlugins
module GuestOpenBSD
class Guest < VagrantPlugins::GuestLinux::Guest
def halt
vm.channel.sudo("shutdown -p -h now")
# Wait until the VM's state is actually powered off. If this doesn't
# occur within a reasonable amount of time then simply return which
# will cause Vagrant to force kill the machine.
count = 0
while vm.state != :poweroff
count += 1
return if count >= 30
sleep 1
end
end
end
end
end