You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jr...@apache.org on 2013/04/23 21:52:50 UTC
svn commit: r1471120 - /qpid/trunk/qpid/tools/src/py/qpid-tool
Author: jross
Date: Tue Apr 23 19:52:49 2013
New Revision: 1471120
URL: http://svn.apache.org/r1471120
Log:
QPID-4771: Add --broker and --sasl-mechanism command line options to qpid-tool; this is a patch from Ernie Allen
Modified:
qpid/trunk/qpid/tools/src/py/qpid-tool
Modified: qpid/trunk/qpid/tools/src/py/qpid-tool
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/py/qpid-tool?rev=1471120&r1=1471119&r2=1471120&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/py/qpid-tool (original)
+++ qpid/trunk/qpid/tools/src/py/qpid-tool Tue Apr 23 19:52:49 2013
@@ -707,11 +707,11 @@ class IdRegistry(object):
#=========================================================
def parse_options( argv ):
- _usage = """qpid-tool [OPTIONS] [[<username>/<password>@]<target-host>[:<tcp-port>]]
- --ssl-certificate <path> - Client's SSL certificate (PEM Format file)
- --ssl-key <path> - Client's SSL private key (PEM Format file)"""
+ _usage = """qpid-tool [OPTIONS] [[<username>/<password>@]<target-host>[:<tcp-port>]]"""
parser = optparse.OptionParser(usage=_usage)
+ parser.add_option("-b", "--broker", action="store", type="string", metavar="<address>", help="Address of qpidd broker with syntax: [username/password@] hostname | ip-address [:<port>]")
+ parser.add_option("--sasl-mechanism", action="store", type="string", metavar="<mech>", help="SASL mechanism for authentication (e.g. EXTERNAL, ANONYMOUS, PLAIN, CRAM-MD, DIGEST-MD5, GSSAPI). SASL automatically picks the most secure available mechanism - use this option to override.")
parser.add_option("--ssl-certificate",
action="store", type="string", metavar="<path>",
help="SSL certificate for client authentication")
@@ -727,25 +727,32 @@ def parse_options( argv ):
args = encArgs
conn_options = {}
+ broker_option = None
+ if opts.broker:
+ broker_option = opts.broker
if opts.ssl_certificate:
conn_options['ssl_certfile'] = opts.ssl_certificate
if opts.ssl_key:
if not opts.ssl_certificate:
parser.error("missing '--ssl-certificate' (required by '--ssl-key')")
conn_options['ssl_keyfile'] = opts.ssl_key
- return conn_options, encArgs[1:]
-
+ if opts.sasl_mechanism:
+ conn_options['mechanisms'] = opts.sasl_mechanism
+ return broker_option, conn_options, args[1:]
#=========================================================
# Main Program
#=========================================================
-# Get host name and port if specified on the command line
-conn_options, cargs = parse_options(sys.argv)
-_host = "localhost"
-if len(cargs) > 0:
- _host = cargs[0]
+# Get options specified on the command line
+broker_option, conn_options, cargs = parse_options(sys.argv)
+
+_host = "localhost"
+if broker_option is not None:
+ _host = broker_option
+elif len(cargs) > 0:
+ _host = cargs[0]
# note: prior to supporting options, qpid-tool assumed positional parameters.
# the first argument was assumed to be the broker address. The second argument
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org