From 39362bee2228f6e1ebff990644a41229518e4c0c Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Mon, 16 May 2011 21:48:07 +0000 Subject: do not leave empty file when download failed (bug #374) --- MgaRepo/rpmutil.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MgaRepo/rpmutil.py b/MgaRepo/rpmutil.py index fce2e1c..7f3ebd7 100644 --- a/MgaRepo/rpmutil.py +++ b/MgaRepo/rpmutil.py @@ -552,7 +552,12 @@ def sync(dryrun=False, commit=False, download=False): except KeyError, e: raise Error, "invalid variable %r in download-command "\ "configuration option" % e - execcmd(cmd, show=True) + try: + status, output = execcmd(cmd, show=True) + except Error, e: + os.unlink(sourcepath) + raise Error, "Could not download file %s\n" % url + if os.path.isfile(sourcepath): toadd.append(sourcepath) else: -- cgit v1.2.1