From patchwork Wed Aug 1 16:37:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Spring Zhang X-Patchwork-Id: 10445 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 852FF24027 for ; Wed, 1 Aug 2012 16:37:14 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 4E97EA18F7C for ; Wed, 1 Aug 2012 16:37:14 +0000 (UTC) Received: by mail-yw0-f52.google.com with SMTP id p61so7393063yhp.11 for ; Wed, 01 Aug 2012 09:37:14 -0700 (PDT) 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=EEGaI7BPe3HQZ76wEJAHFbIAJpuy3nNr9NxbEXdTLKo=; b=RGRnphVPWSkLDE6X9jct0zfUTFj9nquusyqw6wLm5oJLfzKclySkScmn+p6pfklaxT pL7Ds5ATbbhM14mSXhULLG+YME0TKxROUYYR4jmc5dO9jWzMTsn/VuzQKjjguKjHyoX0 6wBNmUmIx1B+7crvbE/JtASAQ1gWmyBxq+SjY6Kf4P+6ijNRIChBsSyNlVfeNuCTNtw/ MOoAR8AtK/K3bOxiIESn1IUVwGpAeHtQCbXw+0ruc+pOdUk5b1GioTay5Z2u3mu1wIUc WmMy3PEy3zuuuCaigQgdgN9/Cxjv/6+JykIcbZ+KwKU3hGNYV5aB95WjP9IxKKi9dSVj TEkw== Received: by 10.50.213.39 with SMTP id np7mr6039423igc.51.1343839033816; Wed, 01 Aug 2012 09:37:13 -0700 (PDT) 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.87.40 with SMTP id u8csp209221igz; Wed, 1 Aug 2012 09:37:13 -0700 (PDT) Received: by 10.216.241.200 with SMTP id g50mr8800878wer.79.1343839032561; Wed, 01 Aug 2012 09:37:12 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id ay5si8339262wib.22.2012.08.01.09.37.11 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Aug 2012 09:37:12 -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; 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 1Swbv5-0001KY-Lw for ; Wed, 01 Aug 2012 16:37:11 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 8352AE0415 for ; Wed, 1 Aug 2012 16:37:11 +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: 361 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 361: Use apt-get -o to specify proxy instead of configuration file to reduce proxy setting issue Message-Id: <20120801163711.3327.71964.launchpad@ackee.canonical.com> Date: Wed, 01 Aug 2012 16:37:11 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="15719"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 38c7936bf839cb2346eda82b877bb01d7ebf5fdf X-Gm-Message-State: ALoCoQmM3z4UXiOJtaJYudd6htY2bKuyYvAHSPf6rEiW5lWalbSDNosoKTfFSE2FVk8ns07Q6t22 Merge authors: Spring Zhang (qzhang) Related merge proposals: https://code.launchpad.net/~qzhang/lava-dispatcher/fix-apt-proxy-failure/+merge/117304 proposed by: Spring Zhang (qzhang) review: Approve - Andy Doan (doanac) review: Resubmit - Spring Zhang (qzhang) ------------------------------------------------------------ revno: 361 [merge] committer: Spring Zhang branch nick: lava-dispatcher timestamp: Thu 2012-08-02 00:35:40 +0800 message: Use apt-get -o to specify proxy instead of configuration file to reduce proxy setting issue modified: lava_dispatcher/actions/lava-test.py lava_dispatcher/client/base.py lava_dispatcher/context.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/lava-test.py' --- lava_dispatcher/actions/lava-test.py 2012-07-24 04:00:12 +0000 +++ lava_dispatcher/actions/lava-test.py 2012-08-01 15:41:23 +0000 @@ -29,12 +29,12 @@ def _install_lava_test(client, session): #install bazaar in tester image - session.run('apt-get update') + session.run('%s update' % client.aptget_cmd) #Install necessary packages for build lava-test - cmd = ('apt-get -y --force-yes install ' + cmd = ('%s -y --force-yes install ' 'bzr usbutils python-apt python-setuptools ' 'python-simplejson lsb-release python-keyring ' - 'python-pip') + 'python-pip' % client.aptget_cmd) session.run(cmd, timeout=2400) dispatcher_config = client.context.config @@ -42,7 +42,8 @@ lava_test_deb = dispatcher_config.get("LAVA_TEST_DEB", "") if lava_test_deb != "": logging.debug("Installing %s with apt-get" % lava_test_deb) - session.run("apt-get -y --force-yes install " + lava_test_deb) + session.run("%s -y --force-yes install %s" + % (client.aptget_cmd, lava_test_deb)) else: lava_test_url = dispatcher_config.get("LAVA_TEST_URL") logging.debug("Installing %s with pip" % lava_test_url) @@ -144,11 +145,6 @@ lava_proxy = self.client.context.lava_proxy if lava_proxy: session.run("sh -c 'export http_proxy=%s'" % lava_proxy) - session.run("echo 'Acquire::http::proxy \"%s\";' > /etc/apt/apt.conf.d/30proxy" % lava_proxy) - else: - # If the rootfs is new generated, the cmd will fail, - # just ignore it - session.run("rm -f /etc/apt/apt.conf.d/30proxy") if install_lava_test: _install_lava_test(self.client, session) @@ -162,7 +158,8 @@ if install_deb: debs = " ".join(install_deb) self.run_command_with_test_result( - session, "apt-get -y --force-yes install " + debs, + session, "%s -y --force-yes install %s" + % (self.client.aptget_cmd, debs), 'lava_test_install deb (%s)' % debs, timeout=timeout) if register: @@ -201,9 +198,10 @@ with self.client.reliable_session() as session: #install add-apt-repository - session.run('apt-get -y install python-software-properties') + session.run('%s -y install python-software-properties' + % self.client.aptget_cmd) #add ppa for repository in arg: session.run('add-apt-repository %s < /dev/null' % repository) - session.run('apt-get update') + session.run('%s update' % self.client.aptget_cmd) === modified file 'lava_dispatcher/client/base.py' --- lava_dispatcher/client/base.py 2012-07-23 02:58:42 +0000 +++ lava_dispatcher/client/base.py 2012-08-01 15:41:23 +0000 @@ -274,6 +274,8 @@ self.config = config self.sio = SerialIO(sys.stdout) self.proc = None + # used for apt-get in lava-test.py + self.aptget_cmd = "apt-get" def device_option(self, option_name, *extra): return self.config.get(option_name, *extra) @@ -394,13 +396,8 @@ # take around 15-20 seconds. self.proc.sendline("export http_proxy=%s" % lava_proxy) self.proc.expect(prompt_str, timeout=30) - self.proc.sendline("echo 'Acquire::http::proxy \"%s\";' > /etc/apt/apt.conf.d/30proxy" % lava_proxy) - self.proc.expect(prompt_str, timeout=30) - else: - # If the rootfs is new generated, the cmd will fail, just ignore it - self.proc.sendline("rm -f /etc/apt/apt.conf.d/30proxy") - self.proc.expect(prompt_str, timeout=30) - + self.aptget_cmd = ' '.join([self.aptget_cmd, + "-o Acquire::http::proxy=%s" % lava_proxy]) def boot_master_image(self): raise NotImplementedError(self.boot_master_image) === modified file 'lava_dispatcher/context.py' --- lava_dispatcher/context.py 2012-06-15 20:37:40 +0000 +++ lava_dispatcher/context.py 2012-07-30 17:03:46 +0000 @@ -60,10 +60,7 @@ @property def lava_proxy(self): - proxy = self.config.get("LAVA_PROXY", "") - if proxy == "": - proxy = None - return proxy + return self.config.get("LAVA_PROXY", None) @property def lava_cookies(self):