diff options
| author | Justin Ross <jross@apache.org> | 2013-05-02 10:08:00 +0000 |
|---|---|---|
| committer | Justin Ross <jross@apache.org> | 2013-05-02 10:08:00 +0000 |
| commit | 4f61727dff884c950421be6260a97050861abb82 (patch) | |
| tree | 64c97c28f2475e5c586e316a5b8132b67cae2532 | |
| parent | d1326e89acb90093a86a085a935bea980c70a2d7 (diff) | |
| download | qpid-python-4f61727dff884c950421be6260a97050861abb82.tar.gz | |
QPID-4806: Suppress traceback when access denied; a patch from Ernie Allen
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1478311 13f79535-47bb-0310-9956-ffa450edef68
| -rwxr-xr-x | qpid/tools/src/py/qpid-config | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/qpid/tools/src/py/qpid-config b/qpid/tools/src/py/qpid-config index 8d59dea21e..ecb880be21 100755 --- a/qpid/tools/src/py/qpid-config +++ b/qpid/tools/src/py/qpid-config @@ -377,9 +377,20 @@ class BrokerManager: self.conn = Connection.establish(self.url, **conn_options) self.broker = BrokerAgent(self.conn) - def Disconnect(self): + def Disconnect(self, ignore=True): if self.conn: - self.conn.close() + try: + self.conn.close() + except Exception, e: + if ignore: + # suppress close errors to avoid + # tracebacks when a previous + # exception will be printed to stdout + pass + else: + # raise last exception so complete + # trackback is preserved + raise def Overview(self): exchanges = self.broker.getAllExchanges() @@ -770,7 +781,7 @@ def main(argv=None): # some commands take longer than the default amqp timeout to complete, # so attempt to disconnect until successful, ignoring Timeouts try: - bm.Disconnect() + bm.Disconnect(ignore=False) break except Exception, e: if e.__class__.__name__ != "Timeout": |
