providers/hyperv: usable test

This commit is contained in:
Mitchell Hashimoto 2014-04-10 10:04:03 -07:00
parent 967f7bce1a
commit 740652aef9
1 changed files with 10 additions and 3 deletions

View File

@ -11,9 +11,7 @@ module VagrantPlugins
class Provider < Vagrant.plugin("2", :provider)
attr_reader :driver
def initialize(machine)
@machine = machine
def self.usable?(raise_error=false)
if !Vagrant::Util::Platform.windows?
raise Errors::WindowsRequired
end
@ -26,6 +24,15 @@ module VagrantPlugins
raise Errors::PowerShellRequired
end
true
rescue HyperVError
raise if raise_error
return false
end
def initialize(machine)
@machine = machine
# This method will load in our driver, so we call it now to
# initialize it.
machine_id_changed