From patchwork Fri Nov 30 00:13:14 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: 13298 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 1404E24259 for ; Fri, 30 Nov 2012 00:13:19 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 9A3D5A18FF8 for ; Fri, 30 Nov 2012 00:13:18 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so8364880iag.11 for ; Thu, 29 Nov 2012 16:13:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to: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=HFtgsfP+BBujWQ1HAY2GhqvdY6aAeC98Y/uuOHQrvQs=; b=lRQlbW5fI5jt4+sVotzhXW0TMp3znLs/RtzkCMBYNKZjaMFLt+JNH2lWIDywQfrRle Wsk+qSPDhddgQ5WKSuc+IBEi6oCbrc+pjKnHpEl+Xk5fVifHeBfHzELsow+wDdp8qR1l r/bEZ5xbJkuiRPt3CY2+i98wynmSB+1Mr/203qAdGbezG4JUr4SBWQ8yk+rvN8OuNkq7 O5E4Js9Mz4g5lQSCYEjvKphM7gbpv2CvEzF+3wShr0Lf2750eSQ9DDvvM8Gco1cHOUpS BzV2ABbfrG9IVElDNgx0MSkzlA/Oyq6vll3rfFaqluXhCIvVMnYh+Qi0D1CCCVB4uWfV ScVw== Received: by 10.50.213.69 with SMTP id nq5mr27069590igc.70.1354234398034; Thu, 29 Nov 2012 16:13: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.50.67.148 with SMTP id n20csp948856igt; Thu, 29 Nov 2012 16:13:16 -0800 (PST) Received: by 10.180.83.97 with SMTP id p1mr37411248wiy.2.1354234395387; Thu, 29 Nov 2012 16:13:15 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id w11si2025301wee.131.2012.11.29.16.13.14 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 29 Nov 2012 16:13:15 -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 1TeEEE-0003v1-6C for ; Fri, 30 Nov 2012 00:13:14 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 1B98BE0288 for ; Fri, 30 Nov 2012 00:13:14 +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: 228 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-scheduler/trunk] Rev 228: reject jobs with invalid server urls at submit time Message-Id: <20121130001314.11768.45233.launchpad@ackee.canonical.com> Date: Fri, 30 Nov 2012 00:13:14 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16319"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: a05fd16df6defbc49a001e08a6903bca37e4a316 X-Gm-Message-State: ALoCoQlJRKKj5mmSDEMloKmbXT5JgxGeP+LUgwAnAJhhtipTf9wuRI9aLZWueHwMWdEwK+/XnK1N ------------------------------------------------------------ revno: 228 committer: Michael Hudson-Doyle branch nick: trunk timestamp: Fri 2012-11-30 13:11:57 +1300 message: reject jobs with invalid server urls at submit time modified: lava_scheduler_app/models.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/models.py' --- lava_scheduler_app/models.py 2012-11-14 16:46:33 +0000 +++ lava_scheduler_app/models.py 2012-11-30 00:11:57 +0000 @@ -1,5 +1,6 @@ import logging import simplejson +import urlparse from django.conf import settings from django.contrib.auth.models import User @@ -420,6 +421,11 @@ user, group, is_public = (bundle_stream.user, bundle_stream.group, bundle_stream.is_public) + server = action['parameters']['server'] + parsed_server = urlparse.urlsplit(server) + if parsed_server.hostname is None: + raise ValueError("invalid server: %s" % server) + tags = [] for tag_name in job_data.get('device_tags', []):