In our environment, there is a firewall between client machines and the outside world which prevents downloading the grubby tarball from github. We have the tarball in the autotest tree on the server, though. So push it out as part of the set of files sent to the client. In bootool, look for the tarball in the current directory, the autotest top directory (if running under autotest) and fallback to the remote tarball if neither of those work.
Signed-off-by: Nishanth Aravamudan <n...@us.ibm.com> --- I've used try/catch instead of os.path manipulation because that's supposedly a security hole (in theory, a user can manipulate the file between the check and the open). Also, I've only covered the rsync deployment of autotest, I'm not sure about the others, as to including the grubby tarball. diff --git a/client/tools/boottool b/client/tools/boottool index c0b095c..615c01e 100755 --- a/client/tools/boottool +++ b/client/tools/boottool @@ -1227,18 +1227,34 @@ class Grubby(object): Fetches and verifies the grubby source tarball ''' tarball_name = os.path.basename(GRUBBY_TARBALL_URI) - tarball = os.path.join(topdir, tarball_name) + # first look in the current directory try: - urllib.urlretrieve(GRUBBY_TARBALL_URI, tarball) + tarball = tarball_name + f = open(tarball) except: - return False - - tarball_md5 = md5.md5(open(tarball).read()).hexdigest() + try: + # then the autotest source directory + from autotest.client.shared import global_config + GLOBAL_CONFIG = global_config.global_config + tarball = os.path.join( + GLOBAL_CONFIG.get_config_value('COMMON', 'autotest_top_path'), + tarball_name) + f = open(tarball) + except: + # then try to grab it from github + try: + tarball = os.path.join(topdir, tarball_name) + urllib.urlretrieve(GRUBBY_TARBALL_URI, tarball) + f = open(tarball) + except: + return None + + tarball_md5 = md5.md5(f.read()).hexdigest() if tarball_md5 != GRUBBY_TARBALL_MD5: - return False + return None - return True + return tarball def grubby_build(self, topdir, tarball): @@ -1301,12 +1317,10 @@ class Grubby(object): topdir = tempfile.mkdtemp() - if not self.grubby_install_fetch_tarball(topdir): + tarball = self.grubby_install_fetch_tarball(topdir) + if tarball is None: raise GrubbyInstallException('Failed to fetch grubby tarball') - tarball_name = os.path.basename(GRUBBY_TARBALL_URI) - tarball = os.path.join(topdir, tarball_name) - srcdir = os.path.join(topdir, 'src') install_root = os.path.join(topdir, 'install_root') os.mkdir(install_root) diff --git a/server/autotest_remote.py b/server/autotest_remote.py index 6840514..f19ca31 100644 --- a/server/autotest_remote.py +++ b/server/autotest_remote.py @@ -160,6 +160,9 @@ class BaseAutotest(installable_object.InstallableObject): light_files = [os.path.join(self.source_material, f) for f in os.listdir(self.source_material) if f not in dirs_to_exclude] + # needs updating when grubby version is changed + light_files.append(os.path.join(self.source_material, + "deps/grubby/grubby-8.11-autotest.tar.bz2")) host.send_file(light_files, autodir, delete_dest=True) profilers_autodir = os.path.join(autodir, 'profilers') -- Nishanth Aravamudan <n...@us.ibm.com> IBM Linux Technology Center _______________________________________________ Autotest mailing list Autotest@test.kernel.org http://test.kernel.org/cgi-bin/mailman/listinfo/autotest