From 740652aef96c1a1e26d0a1fb76f1b0aa31bdfe8a Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 10 Apr 2014 10:04:03 -0700 Subject: [PATCH] providers/hyperv: usable test --- plugins/providers/hyperv/provider.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/providers/hyperv/provider.rb b/plugins/providers/hyperv/provider.rb index 957ad6792..58ff9dd33 100644 --- a/plugins/providers/hyperv/provider.rb +++ b/plugins/providers/hyperv/provider.rb @@ -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