From 127c8cddae0077882c6aba1905b351be80016caf Mon Sep 17 00:00:00 2001 From: clime Date: Jan 13 2018 19:48:29 +0000 Subject: move file exists check to the correct place --- diff --git a/rpkglib/lookaside.py b/rpkglib/lookaside.py index 3692afa..53ab2ab 100644 --- a/rpkglib/lookaside.py +++ b/rpkglib/lookaside.py @@ -13,10 +13,6 @@ class CGILookasideCache(pyrpkg.lookaside.CGILookasideCache): if hashtype is None: hashtype = self.hashtype - if os.path.exists(outfile): - if self.file_is_valid(outfile, hash, hashtype=hashtype): - return - self.log.info("Downloading %s", filename) urled_file = filename.replace(' ', '%20') @@ -35,6 +31,11 @@ class CGILookasideCache(pyrpkg.lookaside.CGILookasideCache): return self.download_url % subs def download(self, module, filename, hash, outfile, hashtype=None, **kwargs): + if os.path.exists(outfile): + if self.file_is_valid(outfile, hash, hashtype=hashtype): + self.log.debug("File %s already downloaded.", outfile) + return + download_url = self.get_download_url( module, filename, hash, outfile, hashtype, **kwargs) self.log.debug("Full url: %s", download_url)