[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 83: fix logging of some error messages

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

Commit Message

Paul Larson Aug. 4, 2011, 10:05 p.m.
Merge authors:
  Spring Zhang (qzhang)
Related merge proposals:
  https://code.launchpad.net/~qzhang/lava-dispatcher/print-exc-info-v2/+merge/70410
  proposed by: Spring Zhang (qzhang)
  review: Approve - Paul Larson (pwlars)
------------------------------------------------------------
revno: 83 [merge]
committer: Paul Larson <paul.larson@linaro.org>
branch nick: lava-dispatcher
timestamp: Thu 2011-08-04 23:03:32 +0100
message:
  fix logging of some error messages
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-26 04:55:23 +0000
+++ lava_dispatcher/__init__.py	2011-08-04 07:19:53 +0000
@@ -85,8 +85,8 @@ 
                             err_msg = err_msg + "Lava failed with test: " \
                                 + test_name
                         err_msg = err_msg + traceback.format_exc()
-                        print >> sys.stderr
-                        print >> sys.stderr, err_msg
+                        # output to both serial log and logfile
+                        self.context.client.sio.write(err_msg)
                     else:
                         err_msg = ""
                     self.context.test_data.add_result(cmd['command'], 

=== modified file 'lava_dispatcher/actions/android_deploy.py'
--- lava_dispatcher/actions/android_deploy.py	2011-07-25 09:15:42 +0000
+++ lava_dispatcher/actions/android_deploy.py	2011-08-04 07:19:53 +0000
@@ -44,7 +44,7 @@ 
             client.wait_network_up()
         except:
             tb = traceback.format_exc()
-            print >> sys.stderr, tb
+            client.sio.write(tb)
             raise CriticalError("Network can't probe up when deployment")
 
         try:
@@ -52,7 +52,7 @@ 
                 system, data, use_cache)
         except:
             tb = traceback.format_exc()
-            print >> sys.stderr, tb
+            client.sio.write(tb)
             raise CriticalError("Package can't download when deployment")
 
         boot_tarball = boot_tbz2.replace(LAVA_IMAGE_TMPDIR, '')
@@ -72,7 +72,7 @@ 
             self.purge_linaro_android_sdcard()
         except:
             tb = traceback.format_exc()
-            print >> sys.stderr, tb
+            client.sio.write(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-25 09:15:42 +0000
+++ lava_dispatcher/actions/deploy.py	2011-08-04 07:19:53 +0000
@@ -46,7 +46,7 @@ 
             client.wait_network_up()
         except:
             tb = traceback.format_exc()
-            print >> sys.stderr, tb
+            client.sio.write(tb)
             raise CriticalError("Network can't probe up when deployment")
 
         try:
@@ -54,7 +54,7 @@ 
                 use_cache)
         except:
             tb = traceback.format_exc()
-            print >> sys.stderr, tb
+            client.sio.write(tb)
             raise CriticalError("Deployment tarballs preparation failed")
         boot_tarball = boot_tgz.replace(LAVA_IMAGE_TMPDIR, '')
         root_tarball = root_tgz.replace(LAVA_IMAGE_TMPDIR, '')
@@ -67,7 +67,7 @@ 
             self.deploy_linaro_bootfs(boot_url)
         except:
             tb = traceback.format_exc()
-            print >> sys.stderr, tb
+            client.sio.write(tb)
             raise CriticalError("Deployment failed")
         finally:
             shutil.rmtree(self.tarball_dir)
@@ -133,7 +133,7 @@ 
         if rc:
             shutil.rmtree(tarball_dir)
             tb = traceback.format_exc()
-            print >> sys.stderr, tb
+            client.sio.write(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)
@@ -145,7 +145,7 @@ 
         except:
             shutil.rmtree(tarball_dir)
             tb = traceback.format_exc()
-            print >> sys.stderr, tb
+            client.sio.write(tb)
             raise
         return boot_tgz, root_tgz
 

=== modified file 'lava_dispatcher/actions/lava-test.py'
--- lava_dispatcher/actions/lava-test.py	2011-07-25 09:15:42 +0000
+++ lava_dispatcher/actions/lava-test.py	2011-08-04 07:19:53 +0000
@@ -97,7 +97,7 @@ 
                 response="list-tests", timeout=10)
         except:
             tb = traceback.format_exc()
-            print >> sys.stderr, tb
+            client.sio.write(tb)
             raise OperationFailed("lava-test deployment failed")
 
         for test in tests: