[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 82: restore exception information to help debug

Message ID 20110726050717.26983.97134.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

Spring Zhang July 26, 2011, 5:07 a.m.
Merge authors:
  Spring Zhang (qzhang)
Related merge proposals:
  https://code.launchpad.net/~qzhang/lava-dispatcher/print-exc-info/+merge/69050
  proposed by: Spring Zhang (qzhang)
  review: Approve - Zygmunt Krynicki (zkrynicki)
------------------------------------------------------------
revno: 82 [merge]
committer: Spring Zhang <spring.zhang@linaro.org>
branch nick: lava-dispatcher
timestamp: Tue 2011-07-26 13:04:49 +0800
message:
  restore exception information to help debug
modified:
  lava_dispatcher/__init__.py
  lava_dispatcher/actions/android_deploy.py
  lava_dispatcher/actions/deploy.py
  lava_dispatcher/actions/lava-test.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

Patch

=== modified file 'lava_dispatcher/__init__.py'
--- lava_dispatcher/__init__.py	2011-07-25 16:18:33 +0000
+++ lava_dispatcher/__init__.py	2011-07-26 04:55:23 +0000
@@ -84,8 +84,8 @@ 
                             test_name = params.get('test_name', "Unknown")
                             err_msg = err_msg + "Lava failed with test: " \
                                 + test_name
-                        exc_type, exc_value, exc_traceback = sys.exc_info()
-                        err_msg = err_msg + repr(traceback.format_tb(exc_traceback))
+                        err_msg = err_msg + traceback.format_exc()
+                        print >> sys.stderr
                         print >> sys.stderr, err_msg
                     else:
                         err_msg = ""

=== modified file 'lava_dispatcher/actions/android_deploy.py'
--- lava_dispatcher/actions/android_deploy.py	2011-07-20 10:08:14 +0000
+++ lava_dispatcher/actions/android_deploy.py	2011-07-25 09:15:42 +0000
@@ -22,7 +22,9 @@ 
 from lava_dispatcher.actions import BaseAction
 from lava_dispatcher.config import LAVA_IMAGE_TMPDIR, LAVA_IMAGE_URL, MASTER_STR
 import os
+import sys
 import shutil
+import traceback
 from tempfile import mkdtemp
 from lava_dispatcher.utils import download, download_with_cache
 from lava_dispatcher.client import CriticalError
@@ -41,12 +43,16 @@ 
         try:
             client.wait_network_up()
         except:
+            tb = traceback.format_exc()
+            print >> sys.stderr, tb
             raise CriticalError("Network can't probe up when deployment")
 
         try:
             boot_tbz2, system_tbz2, data_tbz2 = self.download_tarballs(boot,
                 system, data, use_cache)
         except:
+            tb = traceback.format_exc()
+            print >> sys.stderr, tb
             raise CriticalError("Package can't download when deployment")
 
         boot_tarball = boot_tbz2.replace(LAVA_IMAGE_TMPDIR, '')
@@ -65,6 +71,8 @@ 
             self.deploy_linaro_android_testrootfs(system_url)
             self.purge_linaro_android_sdcard()
         except:
+            tb = traceback.format_exc()
+            print >> sys.stderr, tb
             raise CriticalError("Android deployment failed")
         finally:
             shutil.rmtree(self.tarball_dir)

=== modified file 'lava_dispatcher/actions/deploy.py'
--- lava_dispatcher/actions/deploy.py	2011-07-21 02:48:54 +0000
+++ lava_dispatcher/actions/deploy.py	2011-07-25 09:15:42 +0000
@@ -20,8 +20,10 @@ 
 
 from commands import getoutput, getstatusoutput
 import os
+import sys
 import re
 import shutil
+import traceback
 from tempfile import mkdtemp
 
 from lava_dispatcher.actions import BaseAction
@@ -43,12 +45,16 @@ 
         try:
             client.wait_network_up()
         except:
+            tb = traceback.format_exc()
+            print >> sys.stderr, tb
             raise CriticalError("Network can't probe up when deployment")
 
         try:
             boot_tgz, root_tgz = self.generate_tarballs(hwpack, rootfs, 
                 use_cache)
         except:
+            tb = traceback.format_exc()
+            print >> sys.stderr, tb
             raise CriticalError("Deployment tarballs preparation failed")
         boot_tarball = boot_tgz.replace(LAVA_IMAGE_TMPDIR, '')
         root_tarball = root_tgz.replace(LAVA_IMAGE_TMPDIR, '')
@@ -60,6 +66,8 @@ 
             self.deploy_linaro_rootfs(root_url)
             self.deploy_linaro_bootfs(boot_url)
         except:
+            tb = traceback.format_exc()
+            print >> sys.stderr, tb
             raise CriticalError("Deployment failed")
         finally:
             shutil.rmtree(self.tarball_dir)
@@ -124,6 +132,8 @@ 
         rc, output = getstatusoutput(cmd)
         if rc:
             shutil.rmtree(tarball_dir)
+            tb = traceback.format_exc()
+            print >> sys.stderr, tb
             raise RuntimeError("linaro-media-create failed: %s" % output)
         boot_offset = self._get_partition_offset(image_file, board.boot_part)
         root_offset = self._get_partition_offset(image_file, board.root_part)
@@ -134,6 +144,8 @@ 
             self._extract_partition(image_file, root_offset, root_tgz)
         except:
             shutil.rmtree(tarball_dir)
+            tb = traceback.format_exc()
+            print >> sys.stderr, tb
             raise
         return boot_tgz, root_tgz
 

=== modified file 'lava_dispatcher/actions/lava-test.py'
--- lava_dispatcher/actions/lava-test.py	2011-07-20 05:27:33 +0000
+++ lava_dispatcher/actions/lava-test.py	2011-07-25 09:15:42 +0000
@@ -21,6 +21,8 @@ 
 # with this program; if not, see <http://www.gnu.org/licenses>.
 
 from datetime import datetime
+import sys
+import traceback
 from lava_dispatcher.actions import BaseAction
 from lava_dispatcher.client import OperationFailed
 from lava_dispatcher.config import LAVA_RESULT_DIR, MASTER_STR, TESTER_STR
@@ -94,6 +96,8 @@ 
                 'chroot /mnt/root lava-test help',
                 response="list-tests", timeout=10)
         except:
+            tb = traceback.format_exc()
+            print >> sys.stderr, tb
             raise OperationFailed("lava-test deployment failed")
 
         for test in tests: