From: Michal Fojtik <mfoj...@redhat.com>

Signed-off-by: Michal fojtik <mfoj...@redhat.com>
---
 server/lib/drivers.rb |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/server/lib/drivers.rb b/server/lib/drivers.rb
index 722e1d7..7e3af07 100644
--- a/server/lib/drivers.rb
+++ b/server/lib/drivers.rb
@@ -37,6 +37,10 @@ module Deltacloud
         Dir[File.join(File::dirname(__FILE__), '..', 'config', 'drivers', 
'*.yaml')].each do |driver_file|
           Thread::current[:drivers].merge!(YAML::load(File::read(driver_file)))
         end
+        if Thread::current[:drivers].empty?
+          raise "You need to install drivers before starting Deltacloud API"
+          exit(1)
+        end
       end
       Thread::current[:drivers]
     end
@@ -64,7 +68,11 @@ module Deltacloud
     end
 
     def driver
-      require driver_source_name
+      begin
+        require driver_source_name
+      rescue LoadError
+        raise "Driver name not recognized: #{driver_symbol}"
+      end
       @driver ||= driver_class.new
     end
   end
-- 
1.7.4.1

Reply via email to