Commit 899f5736 by Máhonfai Bálint

Fix errors with unlinking

parent 2b4ce60c
......@@ -301,17 +301,20 @@ class Disk(object):
self.get_path()]
subprocess.check_output(cmdline)
except AbortException:
os.unlink(downloaded_file)
if os.path.exists(downloaded_file):
os.unlink(downloaded_file)
if os.path.exists(self.get_path()):
os.unlink(self.get_path())
logger.info("Import of disk %s aborted" % self.name)
except:
os.unlink(downloaded_file)
if os.path.exists(downloaded_file):
os.unlink(downloaded_file)
if os.path.exists(self.get_path()):
os.unlink(self.get_path())
raise
else:
os.unlink(downloaded_file)
if os.path.exists(downloaded_file):
os.unlink(downloaded_file)
if not self.check_valid_image():
os.unlink(self.get_path())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment