=== modified file 'lava_dispatcher/actions/lava-test.py'
@@ -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'
@@ -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'
@@ -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):