diff options
| author | Carl C. Trieloff <cctrieloff@apache.org> | 2008-05-16 14:02:57 +0000 |
|---|---|---|
| committer | Carl C. Trieloff <cctrieloff@apache.org> | 2008-05-16 14:02:57 +0000 |
| commit | c98a518ab1e5428894f1e1063ad76da76c463ace (patch) | |
| tree | 062d306be5bd5c804f1ed4c081f9fdc598e287fe /qpid/python/commands | |
| parent | 8c6a56372184aefefa5501687c570caa3124a97d (diff) | |
| download | qpid-python-c98a518ab1e5428894f1e1063ad76da76c463ace.tar.gz | |
QPID-1067 by tross
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@657069 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python/commands')
| -rwxr-xr-x | qpid/python/commands/qpid-config | 11 | ||||
| -rwxr-xr-x | qpid/python/commands/qpid-queue-stats | 14 | ||||
| -rwxr-xr-x | qpid/python/commands/qpid-route | 13 | ||||
| -rwxr-xr-x | qpid/python/commands/qpid-tool | 4 |
4 files changed, 31 insertions, 11 deletions
diff --git a/qpid/python/commands/qpid-config b/qpid/python/commands/qpid-config index 054ea39e94..a27ff84cdf 100755 --- a/qpid/python/commands/qpid-config +++ b/qpid/python/commands/qpid-config @@ -28,7 +28,7 @@ from threading import Condition from qpid.management import managementClient from qpid.managementdata import Broker from qpid.peer import Closed -from qpid.connection import Connection +from qpid.connection import Connection, ConnectionFailed from qpid.datatypes import uuid4 from qpid.util import connect from time import sleep @@ -72,7 +72,7 @@ def Usage (): print " --durable Queue is durable" print " --file-count N (8) Number of files in queue's persistence journal" print " --file-size N (24) File size in pages (64Kib/page)" - print " --max-queue-size N Maximum in-memory queue size as bytes" + print " --max-queue-size N Maximum in-memory queue size as bytes" print " --max-queue-count N Maximum in-memory queue size as a number of messages" print print "Add Exchange Options:" @@ -100,11 +100,14 @@ class BrokerManager: self.mclient = managementClient (self.spec) self.mchannel = self.mclient.addChannel (self.session) except socket.error, e: - print "Socket Error:", e + print "Socket Error %s - %s" % (e[0], e[1]) sys.exit (1) except Closed, e: - print "Connect Failed:", e + print "Connect Failed %d - %s" % (e[0], e[1]) sys.exit (1) + except ConnectionFailed, e: + print "Connect Failed %d - %s" % (e[0], e[1]) + sys.exit(1) def Disconnect (self): self.mclient.removeChannel (self.mchannel) diff --git a/qpid/python/commands/qpid-queue-stats b/qpid/python/commands/qpid-queue-stats index 8771c7dc5d..1a663797b1 100755 --- a/qpid/python/commands/qpid-queue-stats +++ b/qpid/python/commands/qpid-queue-stats @@ -29,7 +29,7 @@ from threading import Condition from qpid.management import managementClient from qpid.managementdata import Broker from qpid.peer import Closed -from qpid.connection import Connection +from qpid.connection import Connection, ConnectionFailed from qpid.util import connect from time import sleep @@ -67,8 +67,14 @@ class BrokerManager: self.mclient = managementClient (self.spec, None, self.configCb, self.instCb) self.mchannel = self.mclient.addChannel (self.conn.session(self.sessionId)) except socket.error, e: - print "Connect Error:", e - exit (1) + print "Socket Error %s - %s" % (e[0], e[1]) + sys.exit (1) + except Closed, e: + print "Connect Failed %d - %s" % (e[0], e[1]) + sys.exit (1) + except ConnectionFailed, e: + print "Connect Failed %d - %s" % (e[0], e[1]) + sys.exit(1) def setFilter(self,filter): self.filter = filter @@ -143,7 +149,7 @@ class BrokerManager: def main(): p = optparse.OptionParser() p.add_option('--broker-address','-a', default='localhost' , help='broker-addr is in the form: [username/password@] hostname | ip-address [:<port>] \n ex: localhost, 10.1.1.7:10000, broker-host:10000, guest/guest@localhost') - p.add_option('--amqp-spec-file','-s', default='"/usr/share/amqp/amqp.0-10.xml', help='the path to the amqp spec file') + p.add_option('--amqp-spec-file','-s', default='/usr/share/amqp/amqp.0-10.xml', help='the path to the amqp spec file') p.add_option('--filter','-f' ,default=None ,help='a list of comma separated queue names (regex are accepted) to show') options, arguments = p.parse_args() diff --git a/qpid/python/commands/qpid-route b/qpid/python/commands/qpid-route index e839e36821..d87b5bd191 100755 --- a/qpid/python/commands/qpid-route +++ b/qpid/python/commands/qpid-route @@ -27,7 +27,7 @@ import os from qpid.management import managementClient from qpid.managementdata import Broker from qpid.peer import Closed -from qpid.connection import Connection +from qpid.connection import Connection, ConnectionFailed from qpid.util import connect def Usage (): @@ -70,14 +70,21 @@ class RouteManager: try: self.spec = qpid.spec.load (_specpath) self.sessionId = "%s.%d" % (os.uname()[1], os.getpid()) - self.conn = Connection (connect (broker.host, broker.port), self.spec, username=broker.username, password=broker.password) + self.conn = Connection (connect (broker.host, broker.port), self.spec, \ + username=broker.username, password=broker.password) self.conn.start () self.mclient = managementClient (self.spec) self.mch = self.mclient.addChannel (self.conn.session(self.sessionId)) self.mclient.syncWaitForStable (self.mch) except socket.error, e: - print "Connect Error:", e + print "Socket Error %s - %s" % (e[0], e[1]) sys.exit (1) + except Closed, e: + print "Connect Failed %d - %s" % (e[0], e[1]) + sys.exit (1) + except ConnectionFailed, e: + print "Connect Failed %d - %s" % (e[0], e[1]) + sys.exit(1) def Disconnect (self): self.mclient.removeChannel (self.mch) diff --git a/qpid/python/commands/qpid-tool b/qpid/python/commands/qpid-tool index 9977db3518..32fdc9288b 100755 --- a/qpid/python/commands/qpid-tool +++ b/qpid/python/commands/qpid-tool @@ -24,6 +24,7 @@ import getopt import sys import socket from cmd import Cmd +from qpid.connection import ConnectionFailed from qpid.managementdata import ManagementData from shlex import split from qpid.disp import Display @@ -183,6 +184,9 @@ except Closed, e: except IOError, e: print "IOError: %d - %s: %s" % (e.errno, e.strerror, e.filename) sys.exit (1) +except ConnectionFailed, e: + print "Connect Failed %d - %s" % (e[0], e[1]) + sys.exit(1) # Instantiate the CLI interpreter and launch it. cli = Mcli (data, disp) |
