From patchwork Mon Jan 30 20:58:17 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: 6452 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 9E00723E81 for ; Mon, 30 Jan 2012 20:58:20 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 8D5DAA1820F for ; Mon, 30 Jan 2012 20:58:20 +0000 (UTC) Received: by mail-bk0-f52.google.com with SMTP id r19so4805606bka.11 for ; Mon, 30 Jan 2012 12:58:20 -0800 (PST) Received: from mr.google.com ([10.204.200.197]) by 10.204.200.197 with SMTP id ex5mr10529430bkb.128.1327957100537 (num_hops = 1); Mon, 30 Jan 2012 12:58:20 -0800 (PST) Received: by 10.204.200.197 with SMTP id ex5mr9135713bkb.128.1327957099113; Mon, 30 Jan 2012 12:58:19 -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.204.130.220 with SMTP id u28cs163924bks; Mon, 30 Jan 2012 12:58:18 -0800 (PST) Received: by 10.180.109.198 with SMTP id hu6mr31004266wib.16.1327957098158; Mon, 30 Jan 2012 12:58:18 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id k7si15824769wiw.18.2012.01.30.12.58.17 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Jan 2012 12:58:18 -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 1RryIr-0002s9-Pu for ; Mon, 30 Jan 2012 20:58:17 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id B971BE040B for ; Mon, 30 Jan 2012 20:58:17 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-scheduler X-Launchpad-Branch: ~linaro-validation/lava-scheduler/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 121 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-scheduler/trunk] Rev 121: make submit_job give slightly more useful permission errors Message-Id: <20120130205817.14401.98337.launchpad@ackee.canonical.com> Date: Mon, 30 Jan 2012 20:58:17 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14727"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 9f5bb52251cac276fe8c500405f98c566727cf75 Merge authors: Michael Hudson-Doyle (mwhudson) Related merge proposals: https://code.launchpad.net/~mwhudson/lava-scheduler/more-helpful-401s-bug-917390/+merge/90036 proposed by: Michael Hudson-Doyle (mwhudson) review: Approve - Zygmunt Krynicki (zkrynicki) ------------------------------------------------------------ revno: 121 [merge] committer: Michael Hudson-Doyle branch nick: trunk timestamp: Tue 2012-01-31 09:56:39 +1300 message: make submit_job give slightly more useful permission errors modified: lava_scheduler_app/api.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 === modified file 'lava_scheduler_app/api.py' --- lava_scheduler_app/api.py 2011-10-19 21:05:42 +0000 +++ lava_scheduler_app/api.py 2012-01-25 02:42:58 +0000 @@ -16,9 +16,14 @@ def submit_job(self, job_data): if not self.user: - raise xmlrpclib.Fault(401, "Authentication required.") + raise xmlrpclib.Fault( + 401, "Authentication with user and token required for this " + "API.") if not self.user.has_perm('lava_scheduler_app.add_testjob'): - raise xmlrpclib.Fault(403, "Permission denied.") + raise xmlrpclib.Fault( + 403, "Permission denied. User %r does not have the " + "'lava_scheduler_app.add_testjob' permission. Contact " + "the administrators." % self.user.username) try: job = TestJob.from_json_and_user(job_data, self.user) except JSONDecodeError as e: