[asterisk-commits] mjordan: testsuite/asterisk/trunk r2983 - /asterisk/trunk/lib/python/asterisk/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jan 8 09:43:47 CST 2012


Author: mjordan
Date: Sun Jan  8 09:43:41 2012
New Revision: 2983

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=2983
Log:
Change Asterisk start to look for return value instead of exception

Asterisk start depended on cli_exec throwing an exception to know
when to retry.  This caused problems when cli_exec would throw an
exception elsewhere in the testsuite, as those parts of the code
that were inside a twisted reactor callback could cause an exception
in a portion of those code that wasn't handled, killing the reactor
but not propagating to the top-most level.  The Asterisk start now
checks the return value - if no output is returned, it tries again.

Modified:
    asterisk/trunk/lib/python/asterisk/asterisk.py

Modified: asterisk/trunk/lib/python/asterisk/asterisk.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/asterisk.py?view=diff&rev=2983&r1=2982&r2=2983
==============================================================================
--- asterisk/trunk/lib/python/asterisk/asterisk.py (original)
+++ asterisk/trunk/lib/python/asterisk/asterisk.py Sun Jan  8 09:43:41 2012
@@ -139,14 +139,12 @@
 
         start = time.time()
         while True:
-            try:
-                self.cli_exec("core waitfullybooted")
-            except:
+            if (self.cli_exec("core waitfullybooted") != ""):
+                break
+            else:
                 if time.time() - start > 5:
                     break
                 continue
-            else:
-                break
 
     def stop(self):
         """Stop this instance of Asterisk.




More information about the asterisk-commits mailing list