diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 203: extracted just the fix for timeout issues from https://code.launchpad.net/~le-chi-thu/lava-dispat...

Message ID 20120126040413.16021.49103.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Paul Larson Jan. 26, 2012, 4:04 a.m. UTC
------------------------------------------------------------
revno: 203
committer: Paul Larson <paul.larson@linaro.org>
branch nick: lava-dispatcher
timestamp: Wed 2012-01-25 21:59:38 -0600
message:
  extracted just the fix for timeout issues from https://code.launchpad.net/~le-chi-thu/lava-dispatcher/improve-logging-lmc-timeout/+merge/90220 with some slight modification.
  
  Raise the original exception from pexpect, if any, so that it will produce better debug output
modified:
  lava_dispatcher/client/lmc_utils.py


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_dispatcher/client/lmc_utils.py'
--- lava_dispatcher/client/lmc_utils.py	2012-01-22 22:39:22 +0000
+++ lava_dispatcher/client/lmc_utils.py	2012-01-26 03:59:38 +0000
@@ -111,10 +111,11 @@ 
         cmd += ' --rootfs ' + rootfstype
     logging.info("Executing the linaro-media-create command")
     logging.info(cmd)
-    rc = run_dispatcher_snowball_license_fix(cmd)
-    if rc:
+    try:
+        _run_linaro_media_create(cmd)
+    except:
         shutil.rmtree(tarball_dir)
-        raise RuntimeError("linaro-media-create failed: %s" % output)
+        raise
     return image_file
 
 def get_partition_offset(image, partno):
@@ -145,36 +146,32 @@ 
         logging_system('sudo umount ' + mntdir)
         logging_system('rm -rf ' + mntdir)
 
-def run_dispatcher_snowball_license_fix(cmd):
-    try:
-        proc = pexpect.spawn(cmd, logfile=sys.stdout)
-        done = False
-
-        while not done:
-            id = proc.expect(["SNOWBALL CLICK-WRAP",
-                              "Do you accept the",
-                              "Configuring startupfiles",
-                              "Configuring ux500-firmware",
-                              "Configuring lbsd",
-                              "Configuring mali400-dev",
-                              pexpect.EOF], timeout=2400)
-            if id == 0:
+def _run_linaro_media_create(cmd):
+    proc = pexpect.spawn(cmd, logfile=sys.stdout)
+    done = False
+
+    while not done:
+        id = proc.expect(["SNOWBALL CLICK-WRAP",
+                          "Do you accept the",
+                          "Configuring startupfiles",
+                          "Configuring ux500-firmware",
+                          "Configuring lbsd",
+                          "Configuring mali400-dev",
+                          pexpect.EOF], timeout=7200)
+        if id == 0:
+            proc.send('\t')
+            time.sleep(1)
+            proc.send('\r')
+
+        elif id == 1:
+            if not mali400:
                 proc.send('\t')
-                time.sleep(1)
-                proc.send('\r')
-
-            elif id == 1:
-                if not mali400:
-                    proc.send('\t')
-                time.sleep(1)
-                proc.send('\r')
-            elif id == 6:
-                done = True
-            elif id == 5:
-                mali400 = True
-            else:
-                mali400 = False
-    except pexpect.ExceptionPexpect:
-        return 1
-
-    return 0
+            time.sleep(1)
+            proc.send('\r')
+        elif id == 6:
+            done = True
+        elif id == 5:
+            mali400 = True
+        else:
+            mali400 = False
+