From patchwork Fri May 6 22:24:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 763442 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p46MOvww004100 for ; Fri, 6 May 2011 22:24:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753151Ab1EFWYk (ORCPT ); Fri, 6 May 2011 18:24:40 -0400 Received: from mail-yw0-f46.google.com ([209.85.213.46]:33672 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753097Ab1EFWYc (ORCPT ); Fri, 6 May 2011 18:24:32 -0400 Received: by ywj3 with SMTP id 3so1351508ywj.19 for ; Fri, 06 May 2011 15:24:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:cc:subject:date:message-id :x-mailer:in-reply-to:references; bh=+spiu+iNDGiOg4fI4Cx32xmX2ixHtfMTLx9puFOfjcI=; b=SjVNKseyM7BCt9EAi8nK9EokEbPdSLptEFLs3PaOmbiWEMj9fGPLHtmLH8RyQ/4xJz v61SaWzsb/FdYCoCpncpVyq0Oe7+V3LMR4PVv5AKuKn4MgPRlg2xEmGtG4Gq1+HmslVP GAhzykEEaDHmJApMfiyDhn9sOXphmiHHYOfzk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; b=UZ6058GW/hN00WwNI10TQ1kI3mfbMng/15cTQE0/DO6GxQQC7aUgXBp8CSAaZGIJXK CigwBmSVfABrmPBxIxTCLtPCb3M/bWmwzSbAXoEizdNamGvK+Y1aYKCOYoHgiyJWUN7T nPo24HD4TUyFjw+zEEyUFnoTxnkwhQ2T+N+SQ= Received: by 10.236.184.73 with SMTP id r49mr5650622yhm.59.1304720672430; Fri, 06 May 2011 15:24:32 -0700 (PDT) Received: from localhost.localdomain ([187.112.24.224]) by mx.google.com with ESMTPS id p9sm1698867yhm.7.2011.05.06.15.24.29 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 06 May 2011 15:24:31 -0700 (PDT) From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues Subject: [PATCH 3/4] frontend.afe.resources: Fixing undefined variable error Date: Fri, 6 May 2011 19:24:13 -0300 Message-Id: <1304720654-3724-3-git-send-email-lmr@redhat.com> X-Mailer: git-send-email 1.7.5 In-Reply-To: <1304720654-3724-1-git-send-email-lmr@redhat.com> References: <1304720654-3724-1-git-send-email-lmr@redhat.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 06 May 2011 22:24:58 +0000 (UTC) Signed-off-by: Lucas Meneghel Rodrigues --- frontend/afe/resources.py | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/afe/resources.py b/frontend/afe/resources.py index eaeeea0..b783115 100644 --- a/frontend/afe/resources.py +++ b/frontend/afe/resources.py @@ -1,10 +1,11 @@ from django import http -from autotest_lib.frontend.shared import query_lib, resource_lib +from autotest_lib.frontend.shared import query_lib, resource_lib, exceptions from autotest_lib.frontend.afe import control_file, models, rpc_utils from autotest_lib.frontend.afe import model_attributes from autotest_lib.frontend import thread_local from autotest_lib.client.common_lib import host_protections + class EntryWithInvalid(resource_lib.InstanceEntry): def put(self): if self.instance.invalid: @@ -319,7 +320,7 @@ class Host(EntryWithInvalid): if 'platform' in input_dict: label = self.resolve_link(input_dict['platform']) .instance if not label.platform: - raise BadRequest('Label %s is not a platform' % label.name) + raise exceptions.BadRequest('Label %s is not a platform' % label.name) for label in self.instance.labels.filter(platform=True): self.instance.labels.remove(label) self.instance.labels.add(label) @@ -779,7 +780,7 @@ class QueueEntry(resource_lib.InstanceEntry): def update(self, input_dict): if 'aborted' in input_dict: if input_dict['aborted'] != True: - raise BadRequest('"aborted" can only be set to true') + raise exceptions.BadRequest('"aborted" can only be set to true') query = models.HostQueueEntry.objects.filter(pk=self.instance.pk) models.AclGroup.check_abort_permissions(query) rpc_utils.check_abort_synchronous_jobs(query)