From 6148fe90f9b41eeb37958bbf2727dbeb463f5fa1 Mon Sep 17 00:00:00 2001 From: Hedayat Vatankhah Date: Wed, 13 Jul 2011 22:09:58 +0430 Subject: Make sure that the file is renamed before proceeding --- yum-fast-downloader.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/yum-fast-downloader.py b/yum-fast-downloader.py index d3aa9cb..9a9ceae 100644 --- a/yum-fast-downloader.py +++ b/yum-fast-downloader.py @@ -28,6 +28,7 @@ import shutil import yum from yum.plugins import TYPE_CORE from yum.yumRepo import YumRepository +from time import sleep requires_api_version = '2.6' plugin_type = (TYPE_CORE,) @@ -65,6 +66,13 @@ def downloadFile(urls, remote_path, local_path, proxies = None): if ret: raise yum.plugins.PluginYumExit( "{0} exited with exit code: {1}".format(downloader_app, ret)) + i=0 + while not os.path.exists(local_path): + sleep(0.1) + i+=1 + if i > 50: + raise yum.plugins.PluginYumExit( + "Error in downloading file: {0}".format(local_path)) def queueDownload(inputFile, urls, remote_path, local_path, proxies = None): if urls[0].startswith("http://") or urls[0].startswith("ftp://"): -- cgit