Commit 899f5736 by Máhonfai Bálint

Fix errors with unlinking

parent 2b4ce60c
......@@ -301,16 +301,19 @@ class Disk(object):
self.get_path()]
subprocess.check_output(cmdline)
except AbortException:
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:
if os.path.exists(downloaded_file):
os.unlink(downloaded_file)
if os.path.exists(self.get_path()):
os.unlink(self.get_path())
raise
else:
if os.path.exists(downloaded_file):
os.unlink(downloaded_file)
if not self.check_valid_image():
......
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