Commit 40745061 authored by Gary Wong's avatar Gary Wong

Bug fix: improve error-handling with GENI test script options. Properly document the mandatory and optional parameters in
the help message. Use gnu_getopt instead of getopt.  That way, options
are interpreted anywhere on the command line, instead of before non-option
parameters only.
parent c6a3c283
...@@ -39,6 +39,27 @@ import re ...@@ -39,6 +39,27 @@ import re
def Usage():
print "usage: " + sys.argv[ 0 ] + " [option...] imagename sliver-urn [global]"
print """Options:
-c file, --credentials=file read self-credentials from file
[default: query from SA]
-d, --debug be verbose about XML methods invoked
-f file, --certificate=file read SSL certificate from file
[default: ~/.ssl/encrypted.pem]
-h, --help show options and usage
-l uri, --sa=uri specify uri of slice authority
[default: local]
-m uri, --cm=uri specify uri of component manager
[default: local]
-n name, --slicename=name specify human-readable name of slice
[default: mytestslice]
-p file, --passphrase=file read passphrase from file
[default: ~/.ssl/password]
-r file, --read-commands=file specify additional configuration file
-s file, --slicecredentials=file read slice credentials from file
[default: query from SA]"""
debug = 0 debug = 0
impotent = 1 impotent = 1
doglobal = 1 doglobal = 1
...@@ -84,12 +84,12 @@ if "Usage" not in dir(): ...@@ -84,12 +84,12 @@ if "Usage" not in dir():
[default: query from SA]""" [default: query from SA]"""
try: try:
opts, REQARGS = getopt.getopt( sys.argv[ 1: ], "a:c:df:hl:m:n:p:r:s:", opts, REQARGS = getopt.gnu_getopt( sys.argv[ 1: ], "a:c:df:hl:m:n:p:r:s:",
[ "admincredentials=", "credentials=", [ "admincredentials=", "credentials=",
"debug", "certificate=", "debug", "certificate=",
"help", "sa=", "cm=", "slicename=", "help", "sa=", "cm=", "slicename=",
"passphrase=", "read-commands=", "passphrase=", "read-commands=",
"slicecredentials=", "delete" ] ) "slicecredentials=", "delete" ] )
except getopt.GetoptError, err: except getopt.GetoptError, err:
print >> sys.stderr, str( err ) print >> sys.stderr, str( err )
Usage() Usage()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment