You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2011/08/11 10:42:43 UTC

svn commit: r1156540 - /incubator/deltacloud/trunk/server/bin/deltacloudd

Author: mfojtik
Date: Thu Aug 11 08:42:43 2011
New Revision: 1156540

URL: http://svn.apache.org/viewvc?rev=1156540&view=rev
Log:
Added possibility to list all drivers available in server (--drivers switch)

Modified:
    incubator/deltacloud/trunk/server/bin/deltacloudd

Modified: incubator/deltacloud/trunk/server/bin/deltacloudd
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/bin/deltacloudd?rev=1156540&r1=1156539&r2=1156540&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/bin/deltacloudd (original)
+++ incubator/deltacloud/trunk/server/bin/deltacloudd Thu Aug 11 08:42:43 2011
@@ -45,6 +45,7 @@ BANNER
     options[:config] = File::expand_path(config || DEFAULT_CONFIG)
   end
   opts.on( '-e', '--env ENV', 'Environment (default: "development")') { |env| options[:env] = env }
+  opts.on( '-l', '--drivers', 'List available drivers') { |env| options[:drivers] = true }
   opts.on( '-s', '--ssl', 'Enable SSL (default: disabled)') { |ssl| options[:ssl] = true }
   opts.on( '-k', '--ssl-key KEY', 'SSL key file to use') { |key| options[:ssl_key] = key }
   opts.on( '-C', '--ssl-cert CERT', 'SSL certificate file to use') { |cert| options[:ssl_cert] = cert }
@@ -80,11 +81,21 @@ if options[:help]
  exit(0)
 end
 
-unless ENV["API_DRIVER"]
+unless options[:drivers] or ENV["API_DRIVER"]
   puts "You need to specify a driver to use (-i <driver>)"
+  puts "To list all available drivers try: deltacloudd --drivers"
   exit(1)
 end
 
+if options[:drivers]
+  require 'server.rb'
+  puts "Available drivers:\n\n"
+  puts "* " + driver_config.keys.map{ |d| d.to_s }.join("\n* ")
+  puts
+  exit(0)
+end
+
+
 if options[:ssl]
   unless options[:ssl_key]
     puts "You need to set SSL key using '-k /path/to/keyfile.key'"
@@ -122,6 +133,7 @@ if ENV['API_USER'] && ENV['API_PASSWORD'
 end
 puts
 
+
 dirname="#{File.dirname(__FILE__)}/.."
 
 have_thin = library_present?('thin')
@@ -170,8 +182,6 @@ else
   end
   argv_opts.flatten!
 
-  puts argv_opts.inspect
-
   if have_rerun && options[:env] == "development"
     argv_opts.unshift "thin"
     command = argv_opts.join(" ")
@@ -181,7 +191,6 @@ else
     rerun.join
   else
     thin = Thin::Runner.new(argv_opts)
-
     begin
       thin.run!
     rescue Exception => e