From patchwork Fri Jan 4 19:11:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Terceiro X-Patchwork-Id: 13810 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 3AC0C23F74 for ; Fri, 4 Jan 2013 19:11:16 +0000 (UTC) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by fiordland.canonical.com (Postfix) with ESMTP id CDF09A18FC1 for ; Fri, 4 Jan 2013 19:11:15 +0000 (UTC) Received: by mail-vb0-f47.google.com with SMTP id e21so16865323vbm.34 for ; Fri, 04 Jan 2013 11:11:15 -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=UiUgKlDvCsZjHtJNsqSZpohQP4pvoMpcxPKrGVvmy9g=; b=OEGm9VTQ5CqWXhQ9ET3sZJsFuE17v+qunxdu52Ca39IYJVVcq3cUlGN3yMdL01RFTk gQ4FVQCQHGozJE8p5xA7oQQQiAbB2yiJEslNsgqtU4RtX6FH8qttbwfQSJAhqZa5upNx 8apwt2oBYNyWH3Qh7AlkPxu44XuEX5ZwnpD77haVKZN6rZR8B3lcM++jE1PAw/MkViwI eNAgZMQSnwiFGrJYtJT3u3L81k6cJbx7xAwFeEayhcta/DqLPwPWp4i+JymCfH+zfoIw MRczGAPwSV8HeQ1TRZOfQ/01mXQCf81AFet56SELQnTC0Bsx8RbJgVRAmjKQ1s8hWSqB E6sQ== X-Received: by 10.58.210.65 with SMTP id ms1mr78229262vec.59.1357326675300; Fri, 04 Jan 2013 11:11:15 -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 st5csp151622veb; Fri, 4 Jan 2013 11:11:14 -0800 (PST) X-Received: by 10.194.236.166 with SMTP id uv6mr85501960wjc.34.1357326673680; Fri, 04 Jan 2013 11:11:13 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id i3si460282wie.22.2013.01.04.11.11.11 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 04 Jan 2013 11:11:13 -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 1TrCff-0003Ov-L4 for ; Fri, 04 Jan 2013 19:11:11 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 90A52E00A8 for ; Fri, 4 Jan 2013 19:11:11 +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: 518 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 518: Better handling of target devices on command line Message-Id: <20130104191111.27286.35841.launchpad@ackee.canonical.com> Date: Fri, 04 Jan 2013 19:11:11 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16393"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: ec313a1568eee53c7174532d72f9796d45a0e44c X-Gm-Message-State: ALoCoQk1PlxMWQ5bzLLaJEKr+gJZj4L5ErhSh7/Ml0ZUiLcZKVp3PyP6S+QCp9y0tNmogkd33OUR ------------------------------------------------------------ revno: 518 committer: Antonio Terceiro branch nick: better-target-cmdline-handling timestamp: Fri 2013-01-04 11:35:51 -0300 message: Better handling of target devices on command line If the job file does not specify a target device and no target was specified on the command line, print an error message instead of crashing with KeyError. modified: lava/dispatcher/commands.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/commands.py' --- lava/dispatcher/commands.py 2012-12-20 16:59:51 +0000 +++ lava/dispatcher/commands.py 2013-01-04 14:35:51 +0000 @@ -102,8 +102,13 @@ # Load the scenario file with open(self.args.job_file) as stream: jobdata = stream.read() - if self.args.target is not None: json_jobdata = json.loads(jobdata) + + if self.args.target is None: + if 'target' not in json_jobdata: + logging.error("The job file does not specify a target device. You must inform one using the --target option.") + exit(1) + else: json_jobdata['target'] = self.args.target jobdata = json.dumps(json_jobdata) job = LavaTestJob(jobdata, oob_file, config)