From patchwork Mon Nov 19 20:55: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: 12954 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 91A9E23E08 for ; Mon, 19 Nov 2012 20:55:21 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 2075BA180C7 for ; Mon, 19 Nov 2012 20:55:21 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so7169220iej.11 for ; Mon, 19 Nov 2012 12:55:20 -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=J6LmlUioBzAgiB06Nh+gdXN5lqnjT5elkjpRx0iWf30=; b=ZAxdHS4PCgMPMjGk+5tBx/UxNMOaEBJGPnIvF1zhK7nsTCAPcuBrQm0hRHEPKMf2kU 6KKEMUdRKDVUog1SZjcjm2Gi5Ad0iRCb0yd3+9+M9gOjOdg8h9ZfSGfXtGZm/N9gAnNG hdsOKsYXYNxWr+F33vVkfCG7E403oCwfkB4JX1/dIq58bd2DgGEX7hAuIXDGdao7Bzn1 b3jXjtAFlAR9zS5fj87wPl/9nkmk3ptkTSAzrKM5eFEHK15f2LwpgaR/QkqQWl1NhEiT Ny7tlkysH3AjjLTVG1F5+46pZVGJqvSc3RttUju7jKN9OD5+8O8xB8Xe8uLG4zsTIvey kyIw== Received: by 10.50.152.137 with SMTP id uy9mr7715707igb.62.1353358520519; Mon, 19 Nov 2012 12:55:20 -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 n20csp223712igt; Mon, 19 Nov 2012 12:55:19 -0800 (PST) Received: by 10.180.103.39 with SMTP id ft7mr7689793wib.15.1353358518519; Mon, 19 Nov 2012 12:55:18 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id ec3si1627663wib.44.2012.11.19.12.55.17 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 19 Nov 2012 12:55: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 1TaYNB-0002wz-Kv for ; Mon, 19 Nov 2012 20:55:17 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 8D1BCE016F for ; Mon, 19 Nov 2012 20:55:17 +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: 458 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 458: use linaro-dashboard-bundle classes to ensure the submitted bundle is both valid and in the lates... Message-Id: <20121119205517.28531.5079.launchpad@ackee.canonical.com> Date: Mon, 19 Nov 2012 20:55: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="16286"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 730e6024637450342b2812fce3012bd1fd25bd4d X-Gm-Message-State: ALoCoQn2QOl6q7SWoLgl+mXEOUtMdqw9pFPtRaAKl3iR0l8wAkdgzi1n3CXgGdjMkKrFbrX/JpdO Merge authors: Michael Hudson-Doyle (mwhudson) Related merge proposals: https://code.launchpad.net/~mwhudson/lava-dispatcher/evolve-bundles-before-merging/+merge/135001 proposed by: Michael Hudson-Doyle (mwhudson) review: Approve - Andy Doan (doanac) ------------------------------------------------------------ revno: 458 [merge] committer: Michael Hudson-Doyle branch nick: trunk timestamp: Tue 2012-11-20 09:54:31 +1300 message: use linaro-dashboard-bundle classes to ensure the submitted bundle is both valid and in the latest format modified: lava_dispatcher/actions/launch_control.py setup.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/actions/launch_control.py' --- lava_dispatcher/actions/launch_control.py 2012-11-08 23:35:16 +0000 +++ lava_dispatcher/actions/launch_control.py 2012-11-19 20:32:14 +0000 @@ -19,20 +19,21 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, see . -import json import os import logging import tempfile import urlparse import xmlrpclib -import lava_dispatcher.utils as utils - from lava_tool.authtoken import AuthenticatingServerProxy, MemoryAuthBackend +from linaro_dashboard_bundle.io import DocumentIO +from linaro_dashboard_bundle.evolution import DocumentEvolution + from lava_dispatcher.actions import BaseAction from lava_dispatcher.client.base import OperationFailed from lava_dispatcher.test_data import create_attachment +import lava_dispatcher.utils as utils class GatherResultsError(Exception): @@ -108,8 +109,9 @@ content = None try: with open(fname, 'r') as f: - content = f.read() - bundles.append(json.loads(content)) + doc = DocumentIO.load(f)[1] + DocumentEvolution.evolve_document(doc) + bundles.append(doc) except ValueError: msg = 'Error adding result bundle %s' % fname errors.append(msg) @@ -153,10 +155,10 @@ bundle = "%s/%s" % (self.context.host_result_dir, bundle_name) content = None try: - f = open(bundle) - content = f.read() - f.close() - bundles.append(json.loads(content)) + with open(bundle) as f: + doc = DocumentIO.load(f)[1] + DocumentEvolution.evolve_document(doc) + bundles.append(doc) except ValueError: msg = 'Error adding host result bundle %s' % bundle errors.append(msg) @@ -229,7 +231,7 @@ def submit_bundle(self, main_bundle, server, stream, token): dashboard = _get_dashboard(server, token) - json_bundle = json.dumps(main_bundle) + json_bundle = DocumentIO.dumps(main_bundle) job_name = self.context.job_data.get('job_name', "LAVA Results") try: result = dashboard.put_ex(json_bundle, job_name, stream) === modified file 'setup.py' --- setup.py 2012-11-19 20:04:52 +0000 +++ setup.py 2012-11-19 20:21:20 +0000 @@ -41,6 +41,7 @@ "json-schema-validator >= 2.3", "lava-tool >= 0.4", "lava-utils-interface", + "linaro-dashboard-bundle", "pexpect >= 2.3", "configglue", "PyYAML",