diff mbox

[Branch,~linaro-validation/lava-scheduler/trunk] Rev 65: reduce code duplication a bit

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

Commit Message

Michael-Doyle Hudson Aug. 18, 2011, 2:27 a.m. UTC
------------------------------------------------------------
revno: 65
committer: Michael-Doyle Hudson <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Thu 2011-08-18 14:25:09 +1200
message:
  reduce code duplication a bit
modified:
  lava_scheduler_daemon/board.py
  lava_scheduler_daemon/service.py


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

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

Patch

=== modified file 'lava_scheduler_daemon/board.py'
--- lava_scheduler_daemon/board.py	2011-08-18 02:19:55 +0000
+++ lava_scheduler_daemon/board.py	2011-08-18 02:25:09 +0000
@@ -10,7 +10,9 @@ 
 
 def catchall_errback(logger):
     def eb(failure):
-        logger.exception(failure.value)
+        logger.error(
+            '%s: %s\n%s', failure.type.__name__, failure.value,
+            failure.getTraceback())
     return eb
 
 

=== modified file 'lava_scheduler_daemon/service.py'
--- lava_scheduler_daemon/service.py	2011-08-17 05:33:25 +0000
+++ lava_scheduler_daemon/service.py	2011-08-18 02:25:09 +0000
@@ -4,7 +4,7 @@ 
 from twisted.internet import defer
 from twisted.internet.task import LoopingCall
 
-from lava_scheduler_daemon.board import Board
+from lava_scheduler_daemon.board import Board, catchall_errback
 
 
 class BoardSet(Service):
@@ -21,12 +21,8 @@ 
 
     def _updateBoards(self):
         self.logger.debug("Refreshing board list")
-        def _eb(failure):
-            self.logger.error(
-                '%s: %s\n%s', failure.type.__name__, failure.value,
-                failure.getTraceback())
         return self.source.getBoardList().addCallback(
-            self._cbUpdateBoards).addErrback(_eb)
+            self._cbUpdateBoards).addErrback(catchall_errback(self.logger))
 
     def _cbUpdateBoards(self, board_names):
         if set(board_names) == set(self.boards):