From patchwork Tue Jan 29 04:25:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Doan X-Patchwork-Id: 14326 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 AA62523F91 for ; Tue, 29 Jan 2013 04:25:19 +0000 (UTC) Received: from mail-vb0-f45.google.com (mail-vb0-f45.google.com [209.85.212.45]) by fiordland.canonical.com (Postfix) with ESMTP id 2D7D4A1866C for ; Tue, 29 Jan 2013 04:25:19 +0000 (UTC) Received: by mail-vb0-f45.google.com with SMTP id p1so12150vbi.18 for ; Mon, 28 Jan 2013 20:25:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:content-type:mime-version:x-launchpad-project :x-launchpad-branch:x-launchpad-message-rationale :x-launchpad-branch-revision-number:x-launchpad-notification-type:to :from:subject:message-id:date:reply-to:sender:errors-to:precedence :x-generated-by:x-launchpad-hash:x-gm-message-state; bh=cC1Z2oIAv3YoraMKXz4dOXr+SMKoE/jYXHiHLrhn/n0=; b=nKeEgSJn43AVUNv19C91m2c7o/MtGx8ReQNrvvZxR4ai5rmCeV/cBDV5cWlI8Yuvq4 HnvtZM9A6EFBH+bnN2wdgEPzSUcgjKN7VmxaoNvn3606WwN0HTbs0DxOKrLzb10EDPMK rr6lqLVZATOCfr82mJ1B0lFZq3+iFSpYleU1+UfGK355G+GUTGH/zz7P8y0YYROtrq+p Sb2id2Ut3Rp+zw4weLJb2Hjb21Sh4DsaOEDYTw7JsHrmiWm02+t9P9ZpObt+uvMYsFxE Z35TNTcOYgDrLHOneul3YzeXM2fOhI6sw6dh5ZZ6xfuysj0FuH+IctyGNip4xODHGKeW NjoA== X-Received: by 10.220.209.74 with SMTP id gf10mr186827vcb.10.1359433518640; Mon, 28 Jan 2013 20:25:18 -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.58.145.101 with SMTP id st5csp118049veb; Mon, 28 Jan 2013 20:25:17 -0800 (PST) X-Received: by 10.194.172.228 with SMTP id bf4mr200010wjc.38.1359433517457; Mon, 28 Jan 2013 20:25:17 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id j15si335030wie.19.2013.01.28.20.25.17 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 28 Jan 2013 20:25:17 -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 1U02l2-0007FZ-Rp for ; Tue, 29 Jan 2013 04:25:16 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id C3411E0027 for ; Tue, 29 Jan 2013 04:25:16 +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: 547 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 547: fix support for boot_options in master.py Message-Id: <20130129042516.24806.60701.launchpad@ackee.canonical.com> Date: Tue, 29 Jan 2013 04:25:16 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16451"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: e58b309d2a206a3d0fcd9f8062025b3119d1e7e0 X-Gm-Message-State: ALoCoQmTdNoU8CC6aCrYJ5iBnQH9M1PkXMCw4CDHfFZXzAeleXaf+7ui4XYJ0agB5tpeh/VQGfYF Merge authors: Andy Doan (doanac) Related merge proposals: https://code.launchpad.net/~doanac/lava-dispatcher/boot-cmds/+merge/145282 proposed by: Andy Doan (doanac) ------------------------------------------------------------ revno: 547 [merge] committer: Andy Doan branch nick: lava-dispatcher timestamp: Mon 2013-01-28 22:23:19 -0600 message: fix support for boot_options in master.py this is a regression from past functionality when code was merged to boot_options.py. Its still a confusing hack, but we'll fix for real another day. modified: lava_dispatcher/device/boot_options.py lava_dispatcher/device/master.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/device/boot_options.py' --- lava_dispatcher/device/boot_options.py 2012-11-14 19:37:35 +0000 +++ lava_dispatcher/device/boot_options.py 2013-01-29 04:23:19 +0000 @@ -25,7 +25,7 @@ """ Parses items from a config ini section into an options object. """ - def __init__(self, section, items): + def __init__(self, section, items, defval): self.name = section self.value = None self.allowed = None @@ -35,8 +35,9 @@ elif item[0] == 'allowed': self.allowed = [x.strip() for x in item[1].split(',')] else: - logging.warn('section(%s) contains unknown item: %s' % - (section, item)) + logging.warn('section(%s) contains unknown item: %s', section, item) + if defval: + self.value = defval def valid(self, option): if self.allowed: @@ -45,34 +46,45 @@ return True -def as_dict(target): +def as_dict(target, defaults={}): + """ + converts the boot_options stanza for a device into a dictionary of + key value pairs for the option and its value + + defaults - in some cases you need to override a default value specified + in the device's config. For example for boot_options with master.py, the + default for boot_cmds is boot_cmds. However, we really need to look at + the deployment_data's boot_cmds for the default so that booting + something like android will work. + """ options = {} for opt in target.config.boot_options: if opt in target.config.cp.sections(): - options[opt] = BootOption(opt, target.config.cp.items(opt)) + defval = defaults.get(opt, None) + options[opt] = BootOption(opt, target.config.cp.items(opt), defval) else: - logging.warn('no boot option config section for: %s' % opt) + logging.warn('no boot option config section for: %s', opt) for opt in target.boot_options: keyval = opt.split('=') if len(keyval) != 2: - logging.warn("Invalid boot option format: %s" % opt) + logging.warn("Invalid boot option format: %s", opt) elif keyval[0] not in options: - logging.warn("Invalid boot option: %s" % keyval[0]) + logging.warn("Invalid boot option: %s", keyval[0]) elif not options[keyval[0]].valid(keyval[1]): - logging.warn("Invalid boot option value: %s" % opt) + logging.warn("Invalid boot option value: %s", opt) else: options[keyval[0]].value = keyval[1] return options -def as_string(target, join_pattern): +def as_string(target, join_pattern, defaults={}): """ pulls the options into a string via the join_pattern. The join pattern can be something like "%s=%s" """ - options = as_dict(target) + options = as_dict(target, defaults) cmd = '' for option in options.values(): === modified file 'lava_dispatcher/device/master.py' --- lava_dispatcher/device/master.py 2013-01-16 23:27:28 +0000 +++ lava_dispatcher/device/master.py 2013-01-28 23:43:30 +0000 @@ -405,15 +405,17 @@ def _enter_uboot(self): if self.proc.expect(self.config.interrupt_boot_prompt) != 0: - raise Exception("Faile to enter uboot") + raise Exception("Failed to enter uboot") self.proc.sendline(self.config.interrupt_boot_command) def _boot_linaro_image(self): boot_cmds = self.deployment_data['boot_cmds'] - options = boot_options.as_dict(self) + + options = boot_options.as_dict(self, defaults={'boot_cmds': boot_cmds}) if 'boot_cmds' in options: boot_cmds = options['boot_cmds'].value + logging.info('boot_cmds attribute: %s', boot_cmds) boot_cmds = getattr(self.config, boot_cmds) self._boot(string_to_list(boot_cmds.encode('ascii')))