[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 136: sprinkle logging.exceptions around every except: that could swallow a traceback

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

Commit Message

Michael-Doyle Hudson Oct. 18, 2011, 2:51 a.m.
Merge authors:
  Michael Hudson-Doyle (mwhudson)
Related merge proposals:
  https://code.launchpad.net/~mwhudson/lava-dispatcher/less-total-error-obscuring/+merge/79643
  proposed by: Michael Hudson-Doyle (mwhudson)
------------------------------------------------------------
revno: 136 [merge]
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Tue 2011-10-18 15:49:38 +1300
message:
  sprinkle logging.exceptions around every except: that could swallow a traceback
modified:
  lava_dispatcher/actions/android_basic.py
  lava_dispatcher/actions/boot_control.py
  lava_dispatcher/actions/launch_control.py
  lava_dispatcher/actions/lava-test.py
  lava_dispatcher/android_client.py
  lava_dispatcher/client.py
  lava_dispatcher/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

Patch

=== modified file 'lava_dispatcher/actions/android_basic.py'
--- lava_dispatcher/actions/android_basic.py	2011-09-12 22:31:47 +0000
+++ lava_dispatcher/actions/android_basic.py	2011-10-18 02:38:34 +0000
@@ -114,6 +114,7 @@ 
             else:
                 test_case_result['result'] = "unknown"
         except:
+            logging.exception("getprop sys.boot_completed failed")
             test_case_result['result'] = "fail"
             pass
 

=== modified file 'lava_dispatcher/actions/boot_control.py'
--- lava_dispatcher/actions/boot_control.py	2011-09-23 02:53:30 +0000
+++ lava_dispatcher/actions/boot_control.py	2011-10-18 02:38:34 +0000
@@ -35,6 +35,7 @@ 
         try:
             client.boot_linaro_android_image()
         except:
+            logging.exception("boot_linaro_android_image failed")
             raise CriticalError("Failed to boot test image.")
 
 class cmd_boot_linaro_image(BaseAction):
@@ -49,6 +50,7 @@ 
             logging.info("Boot Linaro image")
             client.boot_linaro_image()
         except:
+            logging.exception("boot_linaro_image failed")
             status = 'fail'
             raise CriticalError("Failed to boot test image.")
         finally:

=== modified file 'lava_dispatcher/actions/launch_control.py'
--- lava_dispatcher/actions/launch_control.py	2011-10-13 09:28:22 +0000
+++ lava_dispatcher/actions/launch_control.py	2011-10-18 02:38:34 +0000
@@ -108,6 +108,7 @@ 
         try:
             self.in_master_shell()
         except:
+            logging.exception("in_master_shell failed")
             client.boot_master_image()
 
         client.run_cmd_master('mkdir -p /mnt/root')
@@ -156,6 +157,8 @@ 
                     except:
                         if time.time() >= now + timeout:
                             raise
+                        else:
+                            logging.exception("download failed, retrying")
             except:
                 logging.warning(traceback.format_exc())
                 status = 'fail'

=== modified file 'lava_dispatcher/actions/lava-test.py'
--- lava_dispatcher/actions/lava-test.py	2011-10-04 04:18:22 +0000
+++ lava_dispatcher/actions/lava-test.py	2011-10-18 02:38:34 +0000
@@ -34,6 +34,7 @@ 
     try:
         client.in_master_shell()
     except:
+        logging.exception("in_master_shell failed")
         client.boot_master_image()
 
     client.run_cmd_master('mkdir -p /mnt/root')
@@ -99,10 +100,12 @@ 
         try:
             rc = client.run_cmd_tester(cmd, timeout=timeout)
         except:
+            logging.exception("run_cmd_tester failed")
             client.proc.sendcontrol('c')
             try:
                 client.run_cmd_tester('true', timeout=20)
             except:
+                logging.exception("run_cmd_tester true failed, rebooting")
                 client.boot_linaro_image()
             raise
         if rc is None:

=== modified file 'lava_dispatcher/android_client.py'
--- lava_dispatcher/android_client.py	2011-10-10 10:19:45 +0000
+++ lava_dispatcher/android_client.py	2011-10-18 02:38:34 +0000
@@ -61,6 +61,7 @@ 
         try:
             self.enter_uboot()
         except:
+            logging.exception('enter_uboot failed')
             self.hard_reboot()
             self.enter_uboot()
         boot_cmds = string_to_list(self.config.get('boot_cmds_android'))
@@ -133,6 +134,7 @@ 
         try:
             ip = self._get_default_nic_ip_by_ifconfig(network_interface)
         except:
+            logging.exception("_get_default_nic_ip_by_ifconfig failed")
             pass
 
         if ip is None:
@@ -162,6 +164,7 @@ 
         try:
             self.run_cmd_tester('netcfg %s dhcp' % nic, timeout=60)
         except:
+            logging.exception("netcfg %s dhcp failed" % nic)
             raise NetworkError("netcfg %s dhcp exception" % nic)
 
 

=== modified file 'lava_dispatcher/client.py'
--- lava_dispatcher/client.py	2011-10-14 19:28:59 +0000
+++ lava_dispatcher/client.py	2011-10-18 02:38:34 +0000
@@ -99,11 +99,9 @@ 
             self.proc.expect("Starting kernel")
             self.in_master_shell()
         except:
+            logging.exception("in_master_shell failed")
             self.hard_reboot()
-            try:
-                self.in_master_shell()
-            except:
-                raise
+            self.in_master_shell()
         self.proc.sendline('export PS1="$PS1 [rc=$(echo \$?)]: "')
         self.proc.expect(self.master_str)
 
@@ -114,6 +112,7 @@ 
         try:
             self.enter_uboot()
         except:
+            logging.exception("enter_uboot failed")
             self.hard_reboot()
             self.enter_uboot()
         boot_cmds = self.boot_cmds

=== modified file 'lava_dispatcher/utils.py'
--- lava_dispatcher/utils.py	2011-09-19 06:15:01 +0000
+++ lava_dispatcher/utils.py	2011-10-18 02:38:34 +0000
@@ -18,6 +18,7 @@ 
 # along
 # with this program; if not, see <http://www.gnu.org/licenses>.
 
+import logging
 import os
 import shutil
 import urllib2
@@ -37,6 +38,7 @@ 
         fd.close()
         response.close()
     except:
+        logging.exception("download failed")
         raise RuntimeError("Could not retrieve %s" % url)
     return filename