On Wed, 2010-01-27 at 09:57 -0500, Jason Guiditta wrote:
On Wed, Jan 27, 2010 at 9:24 AM, Michal Fojtik
<mfojtik(a)redhat.com> wrote:
>
> diff --git a/server/bin/deltacloudd b/server/bin/deltacloudd
> index 33f7108..70da01b 100755
> --- a/server/bin/deltacloudd
> +++ b/server/bin/deltacloudd
> @@ -1,6 +1,6 @@
> #!/usr/bin/env ruby
>
> -if ( ARGV.size != 1 )
> +if (ARGV.empty? || (!ARGV.empty? && ![:ec2, :rhevm, :mock, :rimu,
:rackspace].include?(ARGV[0].to_sym)))
> puts "Usage: deltacloudd <drivername>"
> exit 1
> end
>
The check for a valid driver name should be based off the same list of
driver names as is used internally by the server, so that we can tell
people 'you gave us a bad driver. We only know ec2, rhevm, ...'
The list of drives should be maintained similar to the drivers.rb on the
Sinatra branch.
This is an improvement over current, but NACK for now. We talked in
private about a few ideas to make this more flexible, so lets not push
this until the rework. Main changes are:
* Don't rely on driver being first param with no flag, we should have
a standard flag (and both short (-) and long (--) versions) so we can
just look for the presence of the one we care about.
* Wrap the script/server (commands/server) code so deltacloudd -h will
output our param help along with the standard help
Sounds like a case for optparse. The command line for deltacloudd should
be
deltacloudd [--port|-p PORT] DRIVER
We also go to some length to get the driver from various env vars - I
think that logic should be removed in favor of requiring an explicit
driver on the command line.
David