diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 672: Trival fix for error messaging

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

Commit Message

Tyler Baker Sept. 5, 2013, 11:08 p.m. UTC
------------------------------------------------------------
revno: 672
committer: Tyler Baker <tyler.baker@linaro.org>
branch nick: lava-dispatcher
timestamp: Thu 2013-09-05 16:08:13 -0700
message:
  Trival fix for error messaging
modified:
  lava_dispatcher/context.py
  lava_dispatcher/job.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/context.py'
--- lava_dispatcher/context.py	2013-08-28 14:55:50 +0000
+++ lava_dispatcher/context.py	2013-09-05 23:08:13 +0000
@@ -126,6 +126,11 @@ 
         proc.logfile_read = self.logfile_read
         return proc
 
+    def log(self, msg):
+        self.logfile_read.write(msg)
+        if not msg.endswith('\n'):
+            self.logfile_read.write('\n')
+
     def run_command(self, command, failok=True):
         """run command 'command' with output going to output-dir if specified"""
         if isinstance(command, (str, unicode)):

=== modified file 'lava_dispatcher/job.py'
--- lava_dispatcher/job.py	2013-09-05 17:05:29 +0000
+++ lava_dispatcher/job.py	2013-09-05 23:08:13 +0000
@@ -324,8 +324,8 @@ 
                             err_msg += "Lava failed on test: %s" % \
                                        params.get('test_name', "Unknown")
                         err_msg = err_msg + traceback.format_exc()
-                        print("ErrorMessage: %s" % unicode(str(err)))
-                        print err_msg
+                        self.context.log("ErrorMessage: %s" % unicode(str(err)))
+                        self.context.log(err_msg)
                     else:
                         logging.info(
                             "[ACTION-E] %s is finished successfully." %