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/05/02 12:08:00 UTC

svn commit: r1478311 - /qpid/trunk/qpid/tools/src/py/qpid-config

Author: jross
Date: Thu May  2 10:08:00 2013
New Revision: 1478311

URL: http://svn.apache.org/r1478311
Log:
QPID-4806: Suppress traceback when access denied; a patch from Ernie Allen

Modified:
    qpid/trunk/qpid/tools/src/py/qpid-config

Modified: qpid/trunk/qpid/tools/src/py/qpid-config
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/py/qpid-config?rev=1478311&r1=1478310&r2=1478311&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/py/qpid-config (original)
+++ qpid/trunk/qpid/tools/src/py/qpid-config Thu May  2 10:08:00 2013
@@ -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":



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org