From patchwork Wed Aug 7 09:47:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milo Casagrande X-Patchwork-Id: 18825 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 56526246B3 for ; Wed, 7 Aug 2013 09:47:27 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id f12sf1779953vbg.7 for ; Wed, 07 Aug 2013 02:47:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:delivered-to:mime-version:to:from:subject :message-id:date:reply-to:sender:errors-to:precedence :x-original-sender:x-original-authentication-results:mailing-list :list-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=+RrsM4sxtAMfuM5tFEke3aXZfNRBwUATJXU9UJ+BvmY=; b=jUD6waRIbd/AHGD1b4Qi7VRTMC48oFaHiWyBNJLu6WnlvpZ53N9sVw/RIy9D6qlVJb JcIeFkVVLQJnpb62guRK8P2OcRMv4njY2/+GnWuuiTpEvKb0/9E3R7iRk59zG7zaSbRf I0rRPR1A1BobcC4cQiwADINa34WvYgmaoXdsboy1eofv3vyH1Je1H4rbqX6+z33e7WLA uLyd5oeStt10ZcEEoZGi+4mV4WMP76hwXRHDq1HQpI11wmUFI6TGV/UEQhcq4J+tdROx 9f7Xp2KW4qpCDRu/D8+EXgFpludG/FvOJRX9MHU8gr94s7SYSdmXKhkPiXDfbly8ek2Q AHqQ== X-Received: by 10.236.150.203 with SMTP id z51mr1078289yhj.23.1375868846817; Wed, 07 Aug 2013 02:47:26 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.105.225 with SMTP id gp1ls596791qeb.55.gmail; Wed, 07 Aug 2013 02:47:26 -0700 (PDT) X-Received: by 10.58.154.34 with SMTP id vl2mr763623veb.35.1375868846720; Wed, 07 Aug 2013 02:47:26 -0700 (PDT) Received: from mail-vb0-f45.google.com (mail-vb0-f45.google.com [209.85.212.45]) by mx.google.com with ESMTPS id ur15si1354675veb.70.2013.08.07.02.47.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 07 Aug 2013 02:47:26 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.45 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.45; Received: by mail-vb0-f45.google.com with SMTP id e15so1572711vbg.18 for ; Wed, 07 Aug 2013 02:47:26 -0700 (PDT) X-Gm-Message-State: ALoCoQkf+DDS5HxH7XkLYbsls5TB2s+UKJCAzjtD7fkrRtEykrru2ziMJOdpzC4SruxHERYj74gF X-Received: by 10.58.211.227 with SMTP id nf3mr764932vec.20.1375868846453; Wed, 07 Aug 2013 02:47:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.11.8 with SMTP id pc8csp191797vcb; Wed, 7 Aug 2013 02:47:25 -0700 (PDT) X-Received: by 10.14.173.194 with SMTP id v42mr2218085eel.111.1375868845269; Wed, 07 Aug 2013 02:47:25 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id o41si5182309eew.59.2013.08.07.02.47.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 07 Aug 2013 02:47:25 -0700 (PDT) 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; Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1V70Ky-00073p-JK for ; Wed, 07 Aug 2013 09:47:24 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 81ED5E07E4 for ; Wed, 7 Aug 2013 09:47:24 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-tool X-Launchpad-Branch: ~linaro-validation/lava-tool/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 191 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-tool/trunk] Rev 191: Fixed rpc_endnpoint parameter usage. Message-Id: <20130807094724.16646.48295.launchpad@ackee.canonical.com> Date: Wed, 07 Aug 2013 09:47:24 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: list X-Generated-By: Launchpad (canonical.com); Revision="16721"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 8ce17d78d873180e4cbab2e2c892e9f03bc782b7 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: noreply@launchpad.net X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.45 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Merge authors: Milo Casagrande (milo) Related merge proposals: https://code.launchpad.net/~milo/lava-tool/server-rpc-endpoint-fix/+merge/177658 proposed by: Milo Casagrande (milo) review: Approve - Antonio Terceiro (terceiro) ------------------------------------------------------------ revno: 191 [merge] committer: Milo Casagrande branch nick: trunk timestamp: Wed 2013-08-07 11:42:35 +0200 message: Fixed rpc_endnpoint parameter usage. modified: lava/helper/command.py lava_tool/tests/test_utils.py lava_tool/utils.py --- lp:lava-tool https://code.launchpad.net/~linaro-validation/lava-tool/trunk You are subscribed to branch lp:lava-tool. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-tool/trunk/+edit-subscription === modified file 'lava/helper/command.py' --- lava/helper/command.py 2013-07-31 10:24:23 +0000 +++ lava/helper/command.py 2013-08-07 09:42:35 +0000 @@ -91,10 +91,10 @@ rpc_endpoint_parameter = Parameter("rpc_endpoint", depends=server_name_parameter) - server_url = self.config.get(server_name_parameter) + self.config.get(server_name_parameter) endpoint = self.config.get(rpc_endpoint_parameter) - rpc_url = verify_and_create_url(server_url, endpoint) + rpc_url = verify_and_create_url(endpoint) server = AuthenticatingServerProxy(rpc_url, auth_backend=KeyringAuthBackend()) return server === modified file 'lava_tool/tests/test_utils.py' --- lava_tool/tests/test_utils.py 2013-07-26 09:30:11 +0000 +++ lava_tool/tests/test_utils.py 2013-07-30 17:39:27 +0000 @@ -243,7 +243,7 @@ def test_verify_and_create_url_0(self): expected = "https://www.example.org/" - obtained = verify_and_create_url("www.example.org", "") + obtained = verify_and_create_url("www.example.org") self.assertEquals(expected, obtained) def test_verify_and_create_url_1(self): @@ -253,12 +253,12 @@ def test_verify_and_create_url_2(self): expected = "http://www.example.org/RPC/" - obtained = verify_and_create_url("http://www.example.org", "RPC") + obtained = verify_and_create_url("http://www.example.org/RPC") self.assertEquals(expected, obtained) def test_verify_and_create_url_3(self): expected = "https://www.example.org/RPC/" - obtained = verify_and_create_url("www.example.org/", "/RPC/") + obtained = verify_and_create_url("www.example.org/RPC") self.assertEquals(expected, obtained) def test_create_dir_0(self): === modified file 'lava_tool/utils.py' --- lava_tool/utils.py 2013-07-26 14:12:33 +0000 +++ lava_tool/utils.py 2013-07-30 17:39:27 +0000 @@ -281,7 +281,7 @@ editor)) -def verify_and_create_url(server, endpoint=""): +def verify_and_create_url(endpoint): """Checks that the provided values make a correct URL. If the server address does not contain a scheme, by default it will use @@ -291,25 +291,22 @@ :param server: A server URL to verify. :return A URL. """ - scheme, netloc, path, params, query, fragment = \ - urlparse.urlparse(server) - if not scheme: - scheme = "https" - if not netloc: - netloc, path = path, "" - - if not netloc[-1:] == "/": - netloc += "/" - + url = "" if endpoint: - if endpoint[0] == "/": - endpoint = endpoint[1:] - if not endpoint[-1:] == "/": - endpoint += "/" - netloc += endpoint - - return urlparse.urlunparse( - (scheme, netloc, path, params, query, fragment)) + scheme, netloc, path, params, query, fragment = \ + urlparse.urlparse(endpoint) + if not scheme: + scheme = "https" + if not netloc: + netloc, path = path, "" + + url = urlparse.urlunparse( + (scheme, netloc, path, params, query, fragment)) + + if url[-1:] != "/": + url += "/" + + return url def create_dir(path, dir_name=None):