On 08.06.2012 [20:23:51 -0300], Lucas Meneghel Rodrigues wrote: > On Fri, Jun 8, 2012 at 12:56 PM, Nishanth Aravamudan > <n...@linux.vnet.ibm.com> wrote: > > 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. > > the client can be also deployed through the autotest internal > packaging system. I think it could be something like this: > > job.install_pkg('grubby', 'dep', 'client/deps/grubby') > > As I was recalling the def of the function: > > def install_pkg(self, name, pkg_type, install_dir): > ''' > This method is a simple wrapper around the actual package > installation method in the Packager class. This is used > internally by the profilers, deps and tests code. > name : name of the package (ex: sleeptest, dbench etc.) > pkg_type : Type of the package (ex: test, dep etc.) > install_dir : The directory in which the source is actually > untarred into. (ex: client/profilers/<name> for > profilers) > ''' > if self.pkgmgr.repositories: > self.pkgmgr.install_pkg(name, pkg_type, self.pkgdir, install_dir) > > Need to do more research on it.
Yes, I've not yet used the package manager style deployments so I can't test this. > > 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")) > > ^ I guess if we send the parent directory, any tarball that is in > there will follow. Need to test, but I think it'll work. Yes, in this case, I think we'd just remove 'deps' from the parent directory. However, that will result in the tarball being in a deps directory, I think? Will need to adjust the searching code above. -Nish -- 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