def _fetch_wrapper(url, cb, *args): fetcher = urlfetcher.fetcherForURI(url, "/tmp", meter) try: fetcher.prepareLocation() return cb(fetcher, *args) finally: fetcher.cleanupLocation()
def _prepare(self, guest, meter, scratchdir): logging.debug("Using scratchdir=%s", scratchdir) mediatype = self._get_media_type() # Test suite manually injected a boot kernel if self._install_kernel and not self.scratchdir_required(): return if mediatype == MEDIA_CDROM_IMPLIED: return dev = None if mediatype == MEDIA_CDROM_PATH or mediatype == MEDIA_LOCATION_CDROM: dev = self._prepare_local() if mediatype != MEDIA_CDROM_PATH: fetcher = urlfetcher.fetcherForURI(self.location, scratchdir, meter) try: try: fetcher.prepareLocation() except ValueError, e: logging.exception("Error preparing install location") raise ValueError(_("Invalid install location: ") + str(e)) if mediatype == MEDIA_CDROM_URL: dev = self._prepare_cdrom_url(guest, fetcher) else: self._prepare_kernel_url(guest, fetcher) finally:
def _fetch_distro(distro): print "Fetching distro=%s" % distro.name fetcher = urlfetcher.fetcherForURI(distro.url, "/tmp", meter) try: fetcher.prepareLocation() store = urlfetcher.getDistroStore(guest, fetcher) kernel, initrd, ignore = store.acquireKernel(guest) cleanup.append(kernel) cleanup.append(initrd) distro.kernel = kernel distro.initrd = initrd finally: fetcher.cleanupLocation()
def _testURLWrapper(distroobj): os.environ.pop("VIRTINST_TEST_SUITE", None) logging.debug("Testing for media arch=%s distroclass=%s", distroobj.arch, distroobj.distroclass) sys.stdout.write("\nTesting %-25s " % distroobj.name) sys.stdout.flush() fetcher = urlfetcher.fetcherForURI(distroobj.url, "/tmp", meter) try: fetcher.prepareLocation() return _testURL(fetcher, distroobj) finally: fetcher.cleanupLocation()
def _fetch_distro(distro): print "Fetching distro=%s" % distro.name fetcher = urlfetcher.fetcherForURI(distro.url, "/tmp", meter) origenv = os.environ.pop("VIRTINST_TEST_SUITE") try: fetcher.prepareLocation() store = urlfetcher.getDistroStore(guest, fetcher) kernel, initrd, ignore = store.acquireKernel(guest) cleanup.append(kernel) cleanup.append(initrd) distro.kernel = kernel distro.initrd = initrd except Exception, e: print "fetching distro=%s failed: %s" % (distro.name, e)
def _fetch_distro(distro): print("Fetching distro=%s" % distro.name) fetcher = urlfetcher.fetcherForURI(distro.url, "/tmp", meter) origenv = os.environ.pop("VIRTINST_TEST_SUITE") try: fetcher.prepareLocation() store = urlfetcher.getDistroStore(guest, fetcher) kernel, initrd, ignore = store.acquireKernel(guest) cleanup.append(kernel) cleanup.append(initrd) distro.kernel = kernel distro.initrd = initrd except Exception: logging.error("Fetching distro=%s failed", distro.name, exc_info=True) finally: fetcher.cleanupLocation() if origenv: os.environ["VIRTINST_TEST_SUITE"] = origenv