diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 240: allow the board config to specify how to power cycle a board

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

Commit Message

Michael-Doyle Hudson March 6, 2012, 11:16 p.m. UTC
Merge authors:
  Michael Hudson-Doyle (mwhudson)
Related merge proposals:
  https://code.launchpad.net/~mwhudson/lava-dispatcher/make-hardreset-configurable/+merge/96036
  proposed by: Michael Hudson-Doyle (mwhudson)
  review: Approve - Zygmunt Krynicki (zkrynicki)
  review: Needs Fixing - Spring Zhang (qzhang)
------------------------------------------------------------
revno: 240 [merge]
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Wed 2012-03-07 12:14:20 +1300
message:
  allow the board config to specify how to power cycle a board
modified:
  lava_dispatcher/client/master.py
  lava_dispatcher/config.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/client/master.py'
--- lava_dispatcher/client/master.py	2012-02-29 02:32:27 +0000
+++ lava_dispatcher/client/master.py	2012-03-06 23:12:33 +0000
@@ -631,8 +631,12 @@ 
 
     def hard_reboot(self):
         logging.info("Perform hard reset on the system")
-        self.proc.send("~$")
-        self.proc.sendline("hardreset")
+        cmd = self.device_option("hard_reset_command", "")
+        if cmd != "":
+            logging_system(cmd)
+        else:
+            self.proc.send("~$")
+            self.proc.sendline("hardreset")
 
     def _enter_uboot(self):
         self.proc.expect("Hit any key to stop autoboot")

=== modified file 'lava_dispatcher/config.py'
--- lava_dispatcher/config.py	2011-11-28 20:12:01 +0000
+++ lava_dispatcher/config.py	2012-03-06 01:49:24 +0000
@@ -18,7 +18,7 @@ 
 # along
 # with this program; if not, see <http://www.gnu.org/licenses>.
 
-from ConfigParser import ConfigParser
+from ConfigParser import ConfigParser, NoOptionError
 import os
 import StringIO
 import logging
@@ -72,13 +72,20 @@ 
         _read_into(path, cp)
     return cp
 
+_sentinel = object()
 
 class ConfigWrapper(object):
     def __init__(self, cp, config_dir):
         self.cp = cp
         self.config_dir = config_dir
-    def get(self, key):
-        return self.cp.get("DEFAULT", key)
+    def get(self, key, default=_sentinel):
+        try:
+            return self.cp.get("DEFAULT", key)
+        except NoOptionError:
+            if default is not _sentinel:
+                return default
+            else:
+                raise
     def getint(self, key):
         return self.cp.getint("DEFAULT", key)