From patchwork Tue Mar 6 23:16:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-Doyle Hudson X-Patchwork-Id: 7126 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 99CAC23E64 for ; Tue, 6 Mar 2012 23:16:13 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 40980A183D2 for ; Tue, 6 Mar 2012 23:16:13 +0000 (UTC) Received: by iage36 with SMTP id e36so10385612iag.11 for ; Tue, 06 Mar 2012 15:16:12 -0800 (PST) Received: from mr.google.com ([10.50.197.135]) by 10.50.197.135 with SMTP id iu7mr12215312igc.50.1331075772659 (num_hops = 1); Tue, 06 Mar 2012 15:16:12 -0800 (PST) Received: by 10.50.197.135 with SMTP id iu7mr10156012igc.50.1331075772561; Tue, 06 Mar 2012 15:16:12 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.53.18 with SMTP id k18csp1790ibg; Tue, 6 Mar 2012 15:16:11 -0800 (PST) Received: by 10.216.131.98 with SMTP id l76mr5669926wei.62.1331075770769; Tue, 06 Mar 2012 15:16:10 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id bu19si7913117wib.4.2012.03.06.15.16.10 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Mar 2012 15:16:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1S53c2-0003W4-6L for ; Tue, 06 Mar 2012 23:16:10 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 246ECE0520 for ; Tue, 6 Mar 2012 23:16:10 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-dispatcher X-Launchpad-Branch: ~linaro-validation/lava-dispatcher/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 240 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [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> Date: Tue, 06 Mar 2012 23:16:10 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14900"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: a33dcb5495cd445259e2288d8f9175228fe438ed X-Gm-Message-State: ALoCoQlQNV3eyW7veI0ru/ubsUEWAbwO/43n1oby3wxURcZ4K+W6GTWzo5QyOpO1e3ynMNRG7QRA 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 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 === 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 . -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)