[svn-commits] twilson: testsuite/asterisk/trunk r2870 - /asterisk/trunk/lib/python/asterisk/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Dec 9 11:20:39 CST 2011


Author: twilson
Date: Fri Dec  9 11:20:35 2011
New Revision: 2870

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=2870
Log:
Don't sleep before checking fullybooted, detect error and retry

Review:https://reviewboard.asterisk.org/r/1616/

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=2870&r1=2869&r2=2870
==============================================================================
--- asterisk/trunk/lib/python/asterisk/asterisk.py (original)
+++ asterisk/trunk/lib/python/asterisk/asterisk.py Fri Dec  9 11:20:35 2011
@@ -130,7 +130,6 @@
             return False
 
         # Be _really_ sure that Asterisk has started up before returning.
-        time.sleep(5.0)
 
         # Poll the instance to make sure we created it successfully
         self.process.poll()
@@ -138,7 +137,16 @@
             """ Rut roh, Asterisk process exited prematurely """
             logger.error("Asterisk instance %s exited prematurely with return code %d" % (self.host, self.process.returncode))
 
-        self.cli_exec("core waitfullybooted")
+        start = time.time()
+        while True:
+            try:
+                self.cli_exec("core waitfullybooted")
+            except:
+                if time.time() - start > 5:
+                    break
+                continue
+            else:
+                break
 
     def stop(self):
         """Stop this instance of Asterisk.
@@ -376,7 +384,9 @@
         except IOError:
             pass
         try:
-            process.wait()
+            res = process.wait()
+            if res != 0:
+                raise Exception("Exited non-zero: " % (res,))
         except OSError:
             pass
         return output




More information about the svn-commits mailing list